Installation guide

Search Path
Search Path
In this section...
“About the Search Path” on page 5-23
“How the Search Path Determines W hich Function to U se” on page 5-24
“How MATLAB Finds the Search Path, pathdef.m” on page 5-25
“Viewing and Setting the Search Path” on page 5-26
“Using the Path in Future Sessions” on page 5-31
“Recovering from P roblems with the Search Path” on p age 5-33
About the Search Path
MATLAB uses a search path to find M-files and other MATLAB related files,
which are organized in directories on your file system. By default, the files
supplied with MATLAB and MathWorks products are included in the search
path. This default search path includes many of the directories and files
under
matlabroot/toolbox,wherematlabroot is the directory in which
MATLAB was installed, as returned by running the
matlabroot function.
Any file you want to run or debug in MATLAB must reside in a directory that
is on the search path, or in the current directory. If you create any MATLAB
related files, add the directories containing the files to the MATLAB search
path.
If you try to run or debug a file that is in a directory not on the path, the
action fa il s. When this occurs in the Command Window, MATLAB errors. In
the Editor/Debugger, a dialog box prompts you to
Change Directory Makes the directory containing the file you want to
run become the current directory
Add to Path Adds the directory containing the file to the top of the
search path
Ifthereisalreadyanotherfileofthesamenameonthesearchpath,thefile
you want to run is considered shadow ed. You might need to perform some
5-23