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

46 ビュー (過去 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 Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by