savepath
Save current search path
Description
savepath saves the current MATLAB® search path to an existing pathdef.m file in
the current folder. If there is no pathdef.m file in the
current folder, then savepath saves the search path to the
first pathdef.m file on the current path. If there is no such
file on the current path, then savepath saves the search path
to the pathdef.m file that MATLAB located at startup.
On a Windows® system with User Account Control (UAC) enabled, you might be prompted to allow the update operation because it requires administrator-level permission.
In MATLAB
Online™, changes to the path are automatically saved. Therefore, calling
savepath is not necessary.
savepath saves
the current search path to folderName/pathdef.mpathdef.m located in the folder
specified by folderName. If you do not specify
folderName, then savepath saves
pathdef.m in the current folder.
Use this syntax if you do not have write access to the current
pathdef.m file.
To automatically use the saved search path in a future session, specify
folderName as the MATLAB startup folder.
status = savepath(___) additionally
indicates if the operation is successful, using any of the input arguments
in the previous syntaxes. The status output is 0 when savepath is
successful, and 1 otherwise.
Examples
Input Arguments
Tips
To display the paths to all
pathdef.mfiles in the current folder and on the current search path, usewhich.Thewhich pathdef.m -all
savepathcommand updates the firstpathdef.mfile in this list.To save the search path programmatically each time you exit MATLAB, use
savepathin afinish.mfile.
Version History
Introduced before R2006a