How do I make permanent changes to the MATLAB path using command line functions?

128 views (last 30 days)
How do I make permanent changes to the MATLAB path using command line functions?
The ADDPATH function only adds a folder to the MATLAB path for that session of MATLAB. Once MATLAB is closed and reopened, the folder is no longer on the path. How can I save my MATLAB path so that it is used in future sessions of MATLAB?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This enhancement has been made for Release 14 (R14). For previous product releases, please read below for any possible workarounds:
The PATH2RC function saves the current MATLAB path to the "pathdef.m" file so that it will be used in future sessions of MATLAB. Type "help path2rc" at the MATLAB prompt for more information.
You could also use the graphical path tool by doing the following:
1. Go to "File->Set Path" from within MATLAB or type "pathtool" at the MATLAB prompt.
2. Use the "Add" button to add your desired folder(s) to the MATLAB path.
3. Click "Save" so that this path is used in future MATLAB sessions.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!