I\'ve been chasing the answer to this question in the MATLAB documentation for a long time...
For example, at the bottom of
http://www.mathworks.com/help/matlab/
The best method, I find, is this. Let's say you want MATLAB to start up in mystartupdir
, and you've placed startup.m
in that directory.
On Windows, make a shortcut icon to MATLAB, then right-click on it and select Properties
. Edit the field Start In
. Now, use this icon whenever you want to start MATLAB.
On other platforms, you can run MATLAB with the -sd
flag to specify the startup directory:
matlab -sd mystartupdir
If you don't specify a startup directory, MATLAB will use the default specified by the userpath
command. You can place your startup.m
file there.