The content of this document may be incorrect or outdated.
Print this article Edit this article
Modifying the matlabpath variable
Like UNIX, MATLAB has a search path. The environment variable PATH specifies the UNIX search path; MATLABPATH specifies the initial MATLAB search path. If you enter a name for MATLAB, for example bob, the MATLAB interpreter:
- Looks for bob as a variable.
- Checks for bob as a built-in function.
- Looks in the current directory for a file named bob.m.
- Searches the directories specified by the environment variable MATLABPATH for bob.m.
You can add a directory to MATLABPATH yourself. This allows you to organize your own libraries of M-files. For example, Bob has written his own set of M-files for analyzing geophysical data. He can maintain his library of M-files by putting them in a directory called /~bob/geo and adding this line to his startup file.
setenv MATLABPATH /~bob/geo/
MATLAB places this path ahead of its own MATLABPATH and responds in the normal way so you do not need to copy your M-files into every directory from which you might want to run MATLAB.
Last Modified:
Dec 19, 2016 11:12 am US/Eastern
Created:
Mar 20, 2007 4:53 pm GMT-4
by
admin
JumpURL: