Windows script does not run under macOS Monterey

6 ビュー (過去 30 日間)
Bianca Dickel
Bianca Dickel 2021 年 12 月 10 日
コメント済み: Walter Roberson 2021 年 12 月 16 日
I have a new MacBook Pro M1 2020 with 16GB of memory and I want to run a MATLAB script on it. This script was programmed under WINDOWS and runs there. On my Mac it shows an error in the path.
I have already tried to change the path, but the problem still exists.
Is there a solution that you can switch unhindered between Windows script and Mac script in MATLAB?

採用された回答

Rik
Rik 2021 年 12 月 10 日
It looks like you are mixing \ and /, which might cause issues.
In general you should use filesep or fullfile to create a path out of component folder names. Also, cd is almost never needed. Most functions can be handed a full or relative path and can read files just fine. Using cd forces Matlab to check the new folder for functions and to check if any of the previously cached functions should be reloaded because the function precedence might have changed as a result.
  2 件のコメント
Bianca Dickel
Bianca Dickel 2021 年 12 月 16 日
Thank you very much. i have \ and / adjusted. After that comes this error.
can not you just fix the problem with a toolbox or something? Because now i have to customize the whole script to run on mac.
Walter Roberson
Walter Roberson 2021 年 12 月 16 日
You get that message when file_info is an empty struct -- you did a dir() that returned no results.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by