| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
As an alternative to the savepath function, use the Set Path dialog box.
savepath
savepath folderName/pathdef.m
status = savepath...
savepath saves the current MATLAB search path for use 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.
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.
Save the current search path to pathdef.m, located in I:/my_matlab_files:
savepath I:/my_matlab_files/pathdef.m
addpath, cd, dir, finish, genpath, matlabroot, pathsep, pathtool, rehash, restoredefaultpath, rmpath, startup, userpath, what
Topics in the User Guide:
![]() | saveobj | scatter | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |