| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
As an alternative to the addpath function, use the Set Path dialog box.
addpath('folderName1','folderName2','folderName3'
...)
addpath('folderName1','folderName2','folderName3'
...position)
addpath folderName1 folderName2 folderName3
... -position
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.
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'))
genpath, path, pathsep, rehash, restoredefaultpath, rmpath, savepath
Topics in the User Guide:
![]() | addParamValue (inputParser) | addpref | ![]() |

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 |