MATLAB Function Reference    
addpath

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

Description

addpath('directory') 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.

addpath('dir','dir2','dir3' ...) prepends all the specified directories to the path. Use the full pathname for each dir.

addpath('dir','dir2','dir3' ...'-flag') either prepends or appends the specified directories to the path depending on the value of 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

and MATLAB returns

See Also

path, pathtool, genpath, rehash, rmpath


  addframe addproperty (COM)