Save current search path
status = savepath(___)
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
pathdef.m file on the current path. If there is no such
file on the current path, then
savepath saves the search path
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.
Online™, changes to the path are automatically saved. Therefore, calling
savepath is not necessary.
the current search path to
pathdef.m located in the folder
folderName. If you do not specify
pathdef.m in the current folder.
Use this syntax if you do not have write access to the current
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
Save the current search path to
in the folder,
folderName— Folder name
Folder name, specified as a string array or character vector.
can be a relative or absolute path.
To display the paths to all
in the current folder and on the current search path, use
which pathdef.m -all
savepathcommand updates the first
pathdef.mfile in this list.
To save the search path programmatically each time you exit MATLAB, use
savepath in a