How do I reset my pathdef to its default folder location (the /toolbox/local one)

조회 수: 31 (최근 30일)
i changed the deatult search path by mistake by using the command:
>> savepath C:\Users\tamarh\Documents\MATLAB\pathdef.m
I want to change it back to its default.
However, when I try typing:
>> savepath C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m
I get this error:
Error using savepath
Too many input arguments.
Can someone tell me what is wrong with my syntax and how to fix it? should I just omit the space in the term Program Files, even though there is a space in this folder name?
when I try instead:
>> savepath ('C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m')
I don't get an error, but it doesn't seem to work, because the "which" command doesn't identify the new pathdef:
>> which pathdef.m -all
C:\Users\tamarh\Documents\MATLAB\pathdef.m
Note that the file pathdef.m is there, at that location, but which doesn't find it.
I also checked what my root dir is, and it is the original, expected, one:
>> matlabroot
ans =
'C:\Program Files\MATLAB\R2021b'
Help please!.... which is now my true search path? I need it to be the "\local" folder.
I guess my idea of typing savepath(' ') was wrong, but how do I change back to the \local folder otherwise?
Why do I get the Error of Too many input arguments?...
Thanks!
  댓글 수: 1
Tamar Hoory
Tamar Hoory 2023년 9월 4일
I think I found the answer! if I type this syntax:
>> savepath 'C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m'
then I finally get this result, which recognizes also the pathdef file that is in the \local folder, even though it is shadowes for some reason:
>> which pathdef.m -all
C:\Users\tamarh\Documents\MATLAB\pathdef.m
C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m %Shadowed
After having this progress, the next step was to delete the pathdef.m file from the unwanted location (the Documents folder) and leave only the one in the \local folder.
Then, at last, I get this result:
>> which pathdef.m -all
C:\Program Files\MATLAB\R2021b\toolbox\local\pathdef.m
I think it is very misleading the whole thing: the unclear differences between string, 'string' and ('string'), and also the fact that the file was shadowed at first, even after I got the correct syntax.
hope this helps someone...

댓글을 달려면 로그인하십시오.

채택된 답변

Stefanie Schwarz
Stefanie Schwarz 2023년 9월 26일
I think the easiest way is probably the following:
1) Open MATLAB as an administrator.
2) Delete the pathdef.m from the custom location (but save a copy of it somewhere, just to be save)
3) Use the "which" command to confirm that the pathdef.m from the default location is the only one on your MATLAB path:
>> which pathdef.m -all
C:\Program Files\MATLAB\RXXXXx\toolbox\local\pathdef.m
4) Run "savepath" with no arguments:
>> savepath

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by