MATLAB Answers

0

Why is it sometimes impossible to save the pathdef in 2014a?

Asked by Saeedeh Amirmohseni on 25 Apr 2014
Latest activity Commented on by Jan
on 19 Jun 2019
I think the toolbox of MATLAB is not completely added to the pathdef.m. When I add the toolbox and try to save it, pops up a window, that MATLAB can not save the changes, since the file is read-only, or I might not have access to it. The pathdef is in toolbox\local, and I have administrator rights. Trying to save the path in other place is not possible too. Any ideas on this? P.S: I have noticed, that with adding smaller files, saving the pathdef.m is possible.

  1 Comment

I have the same problem - changing ownership, user rights etc. has no effect. I can edit pathdef.m manually, but from inside matlab it is impossible. starting matlab as administrator has no effect.
-edit: it appears that the problem was with the specific package that I was attempting to add to the path.

Sign in to comment.

Tags

13 Answers

Answer by Jim Hokanson on 19 Dec 2016
Edited by Jim Hokanson on 19 Dec 2016

A colleague of mine was having this issue. I was going to suggest to them that they edit their startup.m file to add all the paths on startup. However, typing 'edit startup' also failed, with an error in strtok.m. It turns out, they had previously added a toolbox with its own custom functions (like strtok.m) that were interfering with some pretty basic Matlab functionality. Removing the offending toolbox (EEG lab) and redownloading it with a newer version fixed the problem.
I think the main take home with this is that the error may not be permissions based, but that any code failure is being caught, and a generic (and perhaps not appropriate/accurate) error message is being thrown.

  1 Comment

@Jim: A good idea. I've looked on the screenshot of Saeedeh again. In fact, there is a long list of warnings for duplicate function names in the background. What a pitty that they have been ignored in the discussion.

Sign in to comment.


Answer by John Murphy on 23 Jul 2018

I was having this same issue and found the source of the error on my machine:
Try running the command "savepath" from the command line rather than from the Matlab "Set Path" option.
For me, this showed that the built-in function "isdir" was replaced by some File Exchange code that I was using, and that code had an error. After removing those files, "savepath" was able to use the correct "isdir", and I was able to save the path again. After this fix, saving the path worked both from the command line and using the "Set Path" dialogs.

  1 Comment

You can find shadowed functions with this tool: FEX: UniqueFuncNames

Sign in to comment.


Answer by Renzo Lanfranco on 1 Mar 2019

I found a viable solution (at least when it's the EEGLAB toolbox): you can add every subfolder manually, one by one. The error only takes place when you try to add all the subfolders at once.
Why? No idea. But it works doing it one by one.

  1 Comment

THIS WORKED FOR ME! WHY?!?!?!
At least it's a work around. I had the problem exactly as described, after upgrading from 2018a to 2019a.

Sign in to comment.


Answer by Jan
on 25 Apr 2014

The question is not clear to me.
Even with admin privileges you have limited access for subfolders of the local program folder. I usually gain write access to the local/ folder for all Matlab users manually.
What does this mean exactly:
Trying to save the path in other place is not possible too.
Please show us the corresponding code.
What is "adding smaller files"?

  2 Comments

Hi Jan,
I just upgraded from 2018a to 2019a and I'm having the same issue that the OP is. Since he hasn't replied in two months, I'm writing to help keep the thread alive.
I have the problem as described: When I add folders and subfolders with the GUI, they do change color and are no longer greyed out, as expected. However, once I select the "Set Path" icon in the Environment section of the Home tab, pressing Save throws this error. However, as noted by Renzo, if I only select a folder and not subfolders, I am able to save.
I should add that I do have administrator access, and this problem persists even if I open it with admin rights.
I'd really appreciate help getting this working, otherwise I've got to go back to 2018a.
Thanks!
Stefan
@Stefan Online: I do not understand your comment exactly.
"add folders and subfolders with the GUI, they do change color" - How do you add folders and subfolders with which GUI and where do which color change?
"pressing Save throws this error" - which error message do you get?
"problem persists even if I open it with admin rights" - if you open what?

Sign in to comment.


Answer by Saeedeh Amirmohseni on 25 Apr 2014

"What does this mean exactly:
Trying to save the path in other place is not possible too." It means, I have tried to save the path under documents\MATLAB too, or at the desktop... just the window pops up every time. Adding smaller files means, means I could add and save some of the subfolders of Toolbox, but when I want to save the whole Toolbox, it just doesn't work. So I think it have nothing to do with Admin privilages. Could it be, that saving too many lines in the pathdef under some circumstances is not possible?

  4 Comments

Show 1 older comment
I use the "Set Path" to add the Toolbox folder of the MATLAB in to the pathdef. I just add a pic here, may be you can follow what i mean.
I have read somewhere, that the folder including the pathdef.m should be at the top. That I have tried as well. No success.
I have the same problem with Matlab R2014a on Win8.1 I can't save the path and get the same error message. When I try to save pathdef.m it in a different location the same message pops up again. I have full administrator rights and have tried running Matlab as administrator but that did not help. I've also checked that i have full rights on all files and folder.
@Saeedeh: Do you see the bunch of warnings in Matlab's command window in the background? Obviously there is a severe problem and Matlab tries desperately to tell you the details. Some functions shadow built-in functions and this can cause serious troubles. Do not ignore these warning only because there is an error message in the foreground also.
Why do you add matlabroot\toolbox to the path? This folder should not contain any functions.

Sign in to comment.


Answer by Ken Atwell
on 4 May 2014

Next time you start MATLAB, navigate to it in the Start Menu (contextual clues tell me you're on Windows) and right-click->"Run as Administrator". Now you should be to overwrite pathdef.m.
I don't recommend running as Administrator unless you're in a situation where you really need to be one (like now). MATLAB is an open-end scripting/programming environment, and with Administrator access a mistyped shell command can reek havoc on your computer.

  1 Comment

Hi Ken, Thank you for the tip. This hasn't helped too. As mentioned before, overwriting in general is not a problem, since I can add some folders.

Sign in to comment.


Answer by kaare
on 5 Sep 2014

have you tried with other folders? the error message is it a bit vague, but in fact you can also get it if there is something in the folder that can't be added to the path. that might explain why you don't have any problems with "small amounts".

  0 Comments

Sign in to comment.


Answer by Sébastien MAILFERT on 16 Jul 2015

Dear all, I have exactly the same problem, not on 2012b but with 2014a. I can set the path, save it to the pathdef.m file but when I close Matlab and open it, the paths are not saved anymore.
Help please!!!! Séb

  1 Comment

This is a different problem. The descriptions of the OP have been too lean already to help him. Attaching a new question in the answers section of this thread is a bad idea.

Sign in to comment.


Answer by Qiaosheng Zhang on 18 Oct 2017

There is some functions maybe have the same name as the built-in function's. Find them and change the function name

  0 Comments

Sign in to comment.


Answer by Jack Beggs on 18 Dec 2017

I was able to resolve this issue by copying the Pathdef.m file out of the Matlab Application folder ("Show Package Contents" on a Mac, under Matlab_R20xxb.app\toolbox\local), opening the file with a script editor, and adding the path to the toolbox there, and saving it. Then, copy it back into your Matlab_R20xxb.app\toolbox\local folder and overwrite the existing pathdef.m file. After doing this your added plugins should load by default.

  0 Comments

Sign in to comment.


Answer by Deepa Gupta on 25 Jan 2018

Thank you for posting this. I re-installed my matlab and am still facing exactly the same issue (screenshot posted by Saeedeh). I tried Jack's solution but matlab is not letting me save pathdef in another location either. so, this is not working for me. I am using 2017b version. If anybody can share any suggestions, it will be greatly appreciated. Thank you in advance.

  0 Comments

Sign in to comment.


Answer by Walter
on 11 Mar 2018
Edited by Walter
on 11 Mar 2018

I am having the same problem with Matlab 2017b. Matlab2016b works fine, however, it would be very nice if the newer version of Matlab worked better than previous.
I am also having an error with fullfile for any code that uses it.

  1 Comment

Please do not inject a new question to an existing thread. This "thread-hijacking" confuses readers, because it is not clear anymore, to which question an answer belongs. Open a new thread instead by asking your own question.
The error message is clear already: One of the inputs o fullfile is a string object, but it accepts char vectors only. The code posted as screenshot does not contain the failing line, so the readers cannot guess where this string is coming from.

Sign in to comment.


Answer by Renzo Lanfranco on 1 Mar 2019

I'm having exactly the same problem with MATLAB 2018a, and also with EEGLAB. None of the solutions suggested works. Please, help!

  0 Comments

Sign in to comment.