필터 지우기
필터 지우기

how to define exactly where the error is

조회 수: 4 (최근 30일)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 12월 31일
댓글: MAHMOUD ALZIOUD 2018년 1월 1일
Happy new year guys, I have a simple question please, I am writing a code in a for loop and it still gives me an error saying Index exceeds matrix dimensions. and it refers to a line that doesn't have matrix in it ! so seems like this is not the line with the error, how can i please track exactly where the error is?

채택된 답변

Walter Roberson
Walter Roberson 2017년 12월 31일
At the command line, try giving the command clear with the function name, like
clear azl_assignment_7
This will remove any copies of the code that it has in memory. This can be needed if you modify code outside of the MATLAB editor, or if you write code files in the program and want to execute the code, or if you had taken the handle of the function in the past.
The only other time I have seen it give the wrong line number was cases where the code had a syntax error, in which case sometimes it gets the wrong line in reporting about the syntax error -- but in such cases the code will not execute at all.
  댓글 수: 9
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2018년 1월 1일
Amazing as usual Mr Walter, thank you very much for your wonderful help. you made sense in many points you mentioned and I will take them into consideration, thank you for the clean up code. and happy new year for you and your blessed family.
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2018년 1월 1일
I just tried it and it worked well, Thank you again very much for pointing out the error source, you were right, I added 2 more columns to class 10.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by