| MATLAB Function Reference | ![]() |
As an alternative to the savepath function, use the Set Path dialog box. To open it, select File > Set Path in the MATLAB® desktop.
savepath
savepath newfile
savepath saves the current search path MATLAB uses to pathdef.m. It returns
0 | If the file was saved successfully |
1 | If the save failed |
savepath newfile saves the current search path to newfile, where newfile is in the current directory or is a relative or absolute path.
The statement
savepath myfiles/pathdef.m
saves the current search path to the file pathdef.m, which is located in the myfiles directory in the current directory for MATLAB.
Consider using savepath in your finish.m file for MATLAB to save the path when you exit MATLAB.
addpath, cd, dir, finish, genpath, matlabroot, partialpath, pathdef, pathsep, pathtool, rehash, restoredefaultpath, rmpath, savepath, startup, userpath, what
Search Path in the MATLAB Desktop Tools and Development Environment documentation
![]() | saveobj | scatter | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |