Documentation Center

  • Trial Software
  • Product Updates
我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

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

| | | | | | | | | | | | |

Was this topic helpful?