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

4 visualizaciones (últimos 30 días)
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 comentarios
Walter Roberson
Walter Roberson el 5 de Jul. de 2024
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 el 8 de Jul. de 2024
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!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by