MATLAB Function Reference | ![]() ![]() |
Add directories to MATLAB search path
Graphical Interface
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.
Syntax
addpath('directory')
addpath('dir','dir2','dir3' ...)
addpath('dir','dir2','dir3' ...
'-flag') addpath dir1 dir2 dir3 ... -flag
Description
addpath('
prepends the specified directory to the current MATLAB search path, that is, it adds them to the top of the path. Use the full pathname for directory')
directory
.
addpath
prepends all the specified directories to the path. Use the full pathname for each ('dir','dir2','dir3' ...)
dir
.
addpath(
either prepends or appends the specified directories to the path depending on the value of 'dir','dir2','dir3' ...
'-flag')
flag
.
flag Argument |
Result |
0 or begin |
Prepend specified directories |
1 or end |
Append specified directories (add to bottom/end) |
addpath dir1 dir2 dir3 ... -flag
is the unquoted form of the syntax.
Examples
For the current path, viewed by typing path
,
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
MATLABPATH c:\matlab\mymfiles c:\matlab\toolbox\general c:\matlab\toolbox\ops c:\matlab\toolbox\strfun
See Also
path
, pathtool
, genpath
, rehash
, rmpath
![]() | addframe | addproperty (COM) | ![]() |