フィルターのクリア

addpath(cd) returns name is nonexistent or not a directory

5 ビュー (過去 30 日間)
Adam Snyder
Adam Snyder 2021 年 12 月 29 日
コメント済み: Adam Danz 2021 年 12 月 30 日
OS: mac OS "Big Sur" v. 11.6
MATLAB: '9.10.0.1739362 (R2021a) Update 5'
If I CD to a directory in my Box folder and type addpath(cd), I get name is non existent or not a directory. How is that possible? I don't have this problem on my other computer running Mojave and Matlab 2020b (I think).
Maybe relevant: I'm running matlab by opening a terminal and executing this:
sudo /applications/Matlab_r2021a.app/bin/matlab
If I just launch matlab by double-clicking the app icon anything relying on Java runs painfully slow... I found somewhere on the help community that running from a terminal instance works around that, which seems to be true.
  2 件のコメント
Adam Snyder
Adam Snyder 2021 年 12 月 29 日
to be clear, cd('~/Box/myfolder') works, but then addpath(cd) throws an error
Adam Danz
Adam Danz 2021 年 12 月 30 日
Does the same behavior occur when you CD to a local folder? I'm not a mac user so I cannot test it. There are known problems associated with CD'ing to remote or cloud folders.

サインインしてコメントする。

採用された回答

Adam Snyder
Adam Snyder 2021 年 12 月 30 日
Ok, this isn't exactly a solution/explanation, but a workaround. I discovered that if I launch MATLAB at the Terminal without sudo, i.e.:
/applications/Matlab_r2021a.app/bin/matlab
.... rather than...
sudo /applications/Matlab_r2021a.app/bin/matlab
...then everything works as expected. It's still puzzling because usually a superuser would have more directory access than a regular user, not less. Also, I'm sure I had been using sudo to solve some other problem that I forgot about and will rediscover in time, but it seems to fix this issue for now anyways. Hopefully MathWorks will patch up whatever issue makes java painfully slow on Big Sur / Catalina soon and I can go back to launching MATLAB like a regular program...

その他の回答 (2 件)

Rik
Rik 2021 年 12 月 30 日
What do you expect to happen when you call cd without any input?
It looks like you actually intend to use addpath(pwd).
  3 件のコメント
Jan
Jan 2021 年 12 月 30 日
@Rik: The complete code of pwd is: wd=cd . So if pwd is working, cd should be working also.
Rik
Rik 2021 年 12 月 30 日
Well, I guess you learn something every day. Thank you Stephen and Jan.
I'll leave my answer up for documentary purposes.

サインインしてコメントする。


Image Analyst
Image Analyst 2021 年 12 月 30 日
The current directory is automatically on the path so perhaps it just throws an error because it does not need to be added via addpath(), though it could probably have chosen a more descriptive error message if that were the case.

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by