0

In this link, there is the unix command

$HOME/.matlab/<version>/matlab.prf.

How to go to this place by using terminal?

4

$HOME is your home directory. This is the directory you are in when you start a terminal window. Normal using on Mac (and most unix-like systems, is that your home directory has the same name as your short user name. So if you are Mike Smith, and have a short user name of msmith then the value of $HOME is (usually) /Volumes/Users/msmith.

HOME is an environment variable. If I create a script or a set of directions and use $HOME instead of /Volumes/Users/msmith, then that script can be used by other people. When I log in, during the startup process MY HOME variable is set to /Volumes/Users/sherwood.

The < > notation means, "Don't type this literally, but find out what the value is, and use that instead. No automatic substitution this time.

In general on Mac and UNIX/Linux/*BSD systems a file in your home directory (possibly other places) that starts with a period contains settings for that software package. So .matlab is a directory of Matlab settings, startup scripts, this and that.

<version> is replaced by the version number of your Matlab installation. You may have several different Matlab versions.

The easiest way to find this is by typing

ls .matlab

In your home directory. I don't have Matlab on my Mac, so I'm only guessing, but you will probably see something like R2009b and/or R2011a.

So if your username was msmith, you could refer to this file as

~/.matlab/R2011a/matlab.prf

The ~ is another shorthand meaning the 'home directory of'. Often you can just use ~ by itself. As ~/.matlab. ~/.matlab and $HOME/.matlab are two ways of saying the same thing.

If you need to GO there -- to see what else is in that directory, just chop off everything after the last / and put cd in front.

Thus

cd ~/.matlab/R2011a/

will leave you in the folder containing matlab.prf


The default settings folder in newer MatLAB versions seems to be $HOME/Library/Application Support/MathWorks/MATLAB/version/ though:

the path to matlab.prf is then e.g.

"$HOME/Library/Application Support/MathWorks/MATLAB/R2016b/matlab.prf"
  • See if it's clearer now. – Sherwood Botsford Dec 4 '16 at 16:10
  • Yep - also mentioning $HOME being an env var is appreciated ;-). I already thought of editing it into your answer myself, but then I hesitated. I will add a proper MatLAB like version number later - I think it looks like this: RYearRevision +1 – klanomath Dec 4 '16 at 16:32
  • You said "$HOME is an environment variable." and $HOME is not a variable, HOME is the variable. In Terminal, if you execute unset $HOME it errors with -bash: unset: /Users/name': not a valid identifier because $HOME is not the variable, it' expands the variable. However unset HOME works without error. See Shell Variables in the BASH manual page. – user3439894 Jan 1 '17 at 12:49
  • Good point @user3439894. Fixed. – Sherwood Botsford Jan 1 '17 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .