You can create a script named
startup.m
under
userpath
(in Windows and Mac OSX, default path is
Documents/MATLAB
). You can add whatever Matlab commands you want into
startup.m
. For example, to add
/usr/local/bin
into PATH, you can add command
setenv('PATH', [getenv('PATH') ':/usr/local/bin']);
into
startup.m
.
BTW, every time Matlab starts, configure file
$MATLABROOT/toolbox/local/matlabrc.m
will be executed.