フィルターのクリア

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 Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by