MATLAB Answers

Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。


Timer stops randomly in the middle of its callback

Kelly Babitz さんによって質問されました 2017 年 8 月 6 日
最新アクティビティ per isakson
さんによって コメントされました 2017 年 9 月 29 日
I have a GUI with a timer. I start the timer, and it randomly will stop at some point while it is running and give the error: Index exceeds matrix dimensions. Error while evaluating TimerFcn for timer 'timer-1'
I do not think there is actually a matrix index it is accessing that is grater than the length of the index for a few reasons:
-All the matrices it accesses are much longer than the index it should be accessing at the time it stops
-The timer stops at different times every time I run it, which makes me feel like there is not a particular index limit that is actually causing problems
-I have commented out all the actual code the timer runs (so the timer literally just runs with no callbacks) and it still will stop at random times with the same error message.
I have no idea how to fix this. Is this just a buggy feature in matlab, or is there something else wrong with what I am doing.
I would also appreciate some help in figuring out how to better debug my code, as the error message does nothing to help me (it gives no line where the error occurs)

  3 件のコメント

"Kelly Babitz: please edit your question and show the complete error message . This means all of the red text.
Walter Roberson
2017 年 8 月 6 日
Posting code would help
per isakson
2017 年 9 月 29 日
The problem is that Matlab doesn't provide a "complete error message". (Caveat: as of R2016a at least)

サインイン to comment.

1 件の回答

回答者: Titus Edelhofer
2017 年 8 月 6 日

what did you write into your timer function, directly some code or the call of a MATLAB (.m) file? If you put your code into a .m file you should get proper error message with line numbers ...

  0 件のコメント

サインイン to comment.

Translated by