フィルターのクリア

"Index in position 2 exceeds array bounds. Index must not exceed 1." But which one?

68 ビュー (過去 30 日間)
Kylen
Kylen 2024 年 7 月 5 日 20:24
コメント済み: Kylen 2024 年 7 月 8 日 15:42
Hi Everyone,
I'm in the process of implementing a chunk of code from a small test script into a larger code that I've been using. The new chunk of code adds some plots, writes some data, etc.
I'm getting an error that reads "Error using MyFileScriptName. Index in position 2 exceeds array bounds. Index must not exceed 1."
I'm by no means an expert, and I can't find where this error is happening. It does not reference a line in the code or a variable name where the index error is happening?
Anybody have any suggestions on how to troubleshoot this?
  2 件のコメント
Walter Roberson
Walter Roberson 2024 年 7 月 5 日 23:32
Do you happen to be compiling the code? Or alternately, do you happen to have pcode'd it? Those could explain the lack of line number.
Meanwhile, give the command
dbstop if error
and execute the code again. It should stop where the problem occurred.
There is a chance you might need to use
dbstop if caught error
Kylen
Kylen 2024 年 7 月 8 日 15:42
Thank you. The "dbstop if error" suggestion helped me identify where my code was erroring out.
And, no, we're not compiling code. Just a small team of engineers trying to run a handful of different Simulink models with a single script. We were running into this error when we combined a few of our Simulink scripts together.
Thanks Again!

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by