Error in Matlab code

2 ビュー (過去 30 日間)
David Harra
David Harra 2021 年 3 月 9 日
コメント済み: Cris LaPierre 2021 年 3 月 9 日
I have attached a picture of my code with error message. It was working yesterday and now it is giving me an error and I don't know why. Everything should be in the same file/directory.
If I delete the num2str(i) in line 15 it works but I need this command to run through all the .mat files in my directory and for some reaosn just stopped working. The 4 2d_simple_array_run files each contain the .mat file.
Any help would be appreciated.

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 3 月 9 日
The error message is correct.
Your path points to a folder onscale1. However, the folder appears to be just onscale.
  2 件のコメント
David Harra
David Harra 2021 年 3 月 9 日
All the files I need to run are saved in the folder onscale and that is the directory I am in? Will i need to change the code to read the files or do I need to change the name of the folder?
Cris LaPierre
Cris LaPierre 2021 年 3 月 9 日
Look at line 15 in your code. The result can be seen in the red error message "Unable to read file...".
Your code is inserting your loop counter into the folder name. This is changing the path to be to a folder that doesn't exist. Remove the num2str(i), and your code should work.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by