"Index in position 2 exceeds array bounds. Index must not exceed 1." But which one?
4 次查看(过去 30 天)
显示 更早的评论
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
2024-7-5
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!