| MATLAB Function Reference | ![]() |
As an alternative to the path function, select File > Set Path to use the Set Path dialog box.
path
path('newpath')
path(path,'newpath')
path('newpath',path)
p = path(...)
path displays the current search path the MATLAB® software uses. The initial search path list is defined by toolbox/local/pathdef.m.
path('newpath') changes the search path to newpath, where newpath is a string array of directories.
path(path,'newpath') adds the newpath directory to the bottom of the current search path. If newpath is already on the path, then path(path, 'newpath') moves newpath to the end of the path.
path('newpath',path) adds the newpath directory to the top of the current search path. If newpath is already on the path, then path('newpath', path) moves newpath to the beginning of the path.
p = path(...) returns the specified path in string variable p.
Note Save any M-files you create and any M-files supplied by The MathWorks™ that you edit in a directory that is not in the matlabroot/toolbox directory tree. If you keep your files in matlabroot/toolbox directories, they can be overwritten when you install a new version of the MATLAB product. Also note that locations of files in the matlabroot/toolbox directory tree are loaded and cached in memory at the beginning of each session of MATLAB to improve performance. If you save files to matlabroot/toolbox directories using an external editor or add or remove files from these directories using file system operations, run rehash toolbox before you use the files in the current session. If you make changes to existing files in matlabroot/toolbox directories using an external editor, run clear functionname before you use the files in the current session. For more information, see the rehash reference page or the Toolbox Path Caching topic in the MATLAB Desktop Tools and Development Environment documentation. |
Add a new directory to the search path on Microsoft® Windows® platforms.
path(path,'c:/tools/goodstuff')
Add a new directory to the search path on The Open Group UNIX® platforms.
path(path,'/home/tools/goodstuff')
addpath, cd, dir, genpath, matlabroot, partialpath, pathdef, pathsep, pathtool, rehash, restoredefaultpath, rmpath, savepath, startup, userpath, what
Search Path in the MATLAB Desktop Tools and Development Environment documentation
![]() | Patch Properties | path2rc | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |