|MATLAB Function Reference|
Add directories to MATLAB search path
As an alternative to the
addpath function, use the Set Path dialog box. To open it, select Set Path from the File menu in the MATLAB desktop.
addpath(' adds the specified directory to the top (also called front) of the current MATLAB search path. Use the full pathname for
addpath adds all the specified directories to the top of the path. Use the full pathname for each
addpath( adds the specified directories to either the top or bottom of the path, depending on the value of
||Add specified directories to the top of the path
||Add specified directories to the bottom (also called end) of the path
addpath dir1 dir2 dir3 ... -flag
is the unquoted form of the syntax.
To recursively add subdirectories of your directory in addition to the directory itself, run
addpath statements in your
startup.m file to use the modified path in future sessions. For details, see Modifying the Path in a startup.m File in the MATLAB Desktop Tools and Development Environment Documentation.
For the current path, viewed by typing
you can add
c:/matlab/mymfiles to the front of the path by typing
Verify that the files were added to the path by typing
and MATLAB returns
You can also use
genpath in conjunction with
addpath to add subdirectories to the path from the command line. For example, to add
/control and its subdirectories to the path, use
Search Path in the MATLAB Desktop Tools and Development Environment Documentation
© 1994-2005 The MathWorks, Inc.