Index in position 1 exceeds array bounds (must not exceed 1).

조회 수: 1 (최근 30일)
Zair Ahmedi
Zair Ahmedi 2019년 7월 10일
답변: Walter Roberson 2019년 7월 16일
How do I know which line has caused this error?
It is difficult for me to check what has casued the errro if I don't know which line.
  댓글 수: 2
Alex Mcaulley
Alex Mcaulley 2019년 7월 10일
It is shown in the red error text of your Command window
Zair Ahmedi
Zair Ahmedi 2019년 7월 16일
There is no such a thing

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2019년 7월 16일
Give the command
dbstop if error
and run the code. If the place it stops is not a try/catch or error() call, then you have found the line with the problem.
If the place it stops is a try/catch or error() call, then give the command
dbstop if caught error
and run the code again. In some cases you might need to dbcont a few times to get to the correct line.
For example if you were having a problem with the objective function for fmincon then fmincon has try/catch statements to smoothly control for errors, and you would need to use the caught error construct to get to the original line.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by