Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

addpath - Add folders to search path

GUI Alternatives

As an alternative to the addpath function, use the Set Path dialog box.

Syntax

addpath('folderName1','folderName2','folderName3' ...)
addpath('folderName1','folderName2','folderName3' ...position)
addpath folderName1 folderName2 folderName3 ... -position

Description

addpath('folderName1','folderName2','folderName3' ...) adds the specified folders to the top of the search path. Use the full path name for each folder. Use genpath with addpath to add all subfolders of folderName. Use addpath statements in a startup.m file to modify the search path programmatically at startup.

addpath('folderName1','folderName2','folderName3' ...position) adds the specified folders to either the top or bottom of the search path, depending on the value of position.

Value of position Argument

Result

'-begin'

Add specified folders to the top of the search path.

'-end'

Add specified folders to the bottom of the search path.

addpath folderName1 folderName2 folderName3 ... -position is the command syntax.

Examples

Add c:/matlab/mymfiles to the top of the search path:

addpath('c:/matlab/mymfiles')

Add c:/matlab/mymfiles to the end of the search path:

addpath c:/matlab/mymfiles -end

Add mymfiles and its subfolders to the search path:

addpath(genpath('c:/matlab/mymfiles'))

See Also

genpath, path, pathsep, rehash, restoredefaultpath, rmpath, savepath

Topics in the User Guide:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS