
5 Workspace, Search Path, and File Operations
By maintaining an un altered pathdef.m in matlabroot/toolbox/local,
you avoid inadvertently removin g directo ries supp lied by The Math Works
from the path. This method continues working even w h en you update to a
new version of MATLAB. If you run MATLAB on both Windows and UNIX
platforms, this method works well — forexample,foreachplatform,include
separate
addpath sections in the startup.m file, with each section preceded
by an
ispc or isunix statement.
One disadvantage of this method is that changes you m ake to the path using
the Set Path dialog box are not incorpo rate d in the
startup.m file.
Saving the Path in the MATLAB Startup Directory
Copy pathdef.m from matlabroot/toolbox/local to the MATLAB
startup directory. Make changes to the path using the Set Path dialog
box, and with
addpath and rmpath functions — choose w hichever suits
your needs. You can use this method if you do not h ave w rite access to
matlabroot/toolbox/local.
There are some disadvantages to this m ethod. You might inadvertently
remove directories supplied by The MathWorks from the path. When you
update to a new version of MATLAB, you ca nnot use the
pathdef.m file in
the startup directory, but must delete it and create a new version. If you
runMATLABonbothWindowsandUNIXplatforms,youneedtomaintain
a separate
pathdef.m file for each.
Saving the Path in matlabroot/toolbox/local
If you have write access to matlabroot/toolbox/local,makeandsave
changes to the path using the Set Path dialog box, and with
addpath and
rmpath functions — choose whichever suits your needs.
There are some disadvantages to this method. You cannot maintain this file
when you update to a new version of MATLAB, but will need to use the new
default
pathdef.m and make changes to it. If you run MATLAB on both
Windows and UNIX platforms, you need to maintain a separate
pathdef.m
file for each.
5-32
Commentaires sur ces manuels