MATLAB Answers

Why strange savepath errors when I add folders to my path?

13 views (last 30 days)
Leslie on 10 Aug 2017
Commented: Walter Roberson on 10 Aug 2017
I just installed the following on a MacBook Pro (OSX 10.11.6): MATLAB 9.2, Curve Fitting Toolbox 3.5.5, Statistics and Machine Learning Toolbox 11.1, Symbolic Math Toolbox 7.2 (Installation folder: /Applications/
• Tried to add folders via the "Set Path" button & window. When I hit the "Save" button, I get a new window with the following error message: ----- MATLAB cannot save changes to the path. The path file, pathdef.m, might be read-only or might be in a folder for which you do not have write access. You can save pathdef.m to a different location. For MATLAB to use that pathdef.m in future sessions, save it in your MATLAB startup folder (the folder from which you start MATLAB). Do you want to save pathdef.m to another location? -----
When I hit the "Yes" button, and choose ~/Documents/MATLAB, I get a warning sound and the same window.
• Here are the results of some command window items:
>> savepath
Error using cellstr (line 24)
S must be 2-D.
Error in cell/strcat (line 17)
varargin{i} = cellstr(varargin{i});
Error in savepath>matlabrootify (line 253)
dirnames(~mlr_dirs) = strcat(' ''',dirnames(~mlr_dirs));
Error in savepath (line 130)
all_path_lines = matlabrootify(all_path_lines);
>> which -all pathdef.m
>> restoredefaultpath; savepath;
[no Command Window messages pop up]
• If I manually add a folder to my path and again issue "savepath", I get the error stream above. If I use the button to add a folder to my path and try to save, I have the same error window as above.
What's going on, and how do I fix it?!


Sign in to comment.

Accepted Answer

Leslie on 10 Aug 2017
Turns out that the "cellstr" and/or "cell/strcat" in that error message appear to be related to a script cellstrcat.m that I downloaded as a folder of routines from a scientist at another institution. If I don't try to add his folder to my path, I'm good. I've shot him an email to give him a heads up.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!