Skip to Main Content Skip to Search
Product Documentation

savepath - Save current search path

Alternatives

As an alternative to the savepath function, use the Set Path dialog box.

Syntax

savepath
savepath folderName/pathdef.m
status = savepath...

Description

savepath updates the MATLAB search path for all users on the system so that the path can be reused in a future session. savepath saves the search path to the pathdef.m file that MATLAB located at startup, or to the current folder if a pathdef.m file exists there. To save the search path programmatically each time you exit MATLAB, use savepath in a finish.m file.. On a Windows system with User Account Control (UAC) enabled, UAC might prompt you to allow the update operation because it requires administrator-level permission.

savepath folderName/pathdef.m saves the current search path to pathdef.m located in folderName. Use this form of the syntax if you do not have write access to the current pathdef.m. If you do not specify folderName, MATLAB saves pathdef.m in the current folder. folderName can be a relative or absolute path. To use the saved search path automatically in a future session, make folderName be the startup folder for MATLAB.

status = savepath... returns 0 when savepath was successful and 1 when savepath failed.

Examples

Save the current search path to pathdef.m, located in I:/my_matlab_files:

savepath I:/my_matlab_files/pathdef.m

See Also

addpath | cd | dir | finish | genpath | matlabroot | pathsep | pathtool | rehash | restoredefaultpath | rmpath | startup | userpath | what

How To

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS