| MATLAB Function Reference | Search  Help Desk |
| path | Examples See Also |
Control MATLAB's directory search path
Syntax
path
p = path
path('newpath')
path(path,'newpath')
path('newpath',path)
Description
path
prints out the current setting of MATLAB's search path. The path resides in pathdef.m (in toolbox/local).
p = path
returns the current search path in string variable p.
path('newpath')
changes the path to the string 'newpath'.
path(path,'newpath')
appends a new directory to the current path.
path('newpath',path)
prepends a new directory to the current path.
Remarks
MATLAB has a search path. If you enter a name, such asfox, the MATLAB interpreter:
fox as a variable.
fox as a built-in function.
fox.mex and fox.m.
path for fox.mex and fox.m.
MATLAB directory tree. If you keep your files in the MATLAB directory tree, they might be overwritten when you install a new version of MATLAB. Another consideration is that files in the MATLAB/toolbox directory tree are loaded and cached into memory at the beginning of each MATLAB session to improve performance. This cache is not updated until MATLAB is restarted. If you add any files or make changes to any files in the toolbox directory, you will not be able to see the changes until you restart MATLAB.
Examples
Add a new directory to the search path on various operating systems| UNIX | path(path,'/home/myfriend/goodstuff') |
| VMS | path(path,'DISKS1:[MYFRIEND.GOODSTUFF]') |
| Windows | path(path,'TOOLS\GOODSTUFF') |
See Also
addpath, cd, dir, partialpath, rmpath, what