MATLAB Answers

Timer stops randomly in the middle of its callback

1 view (last 30 days)
Kelly Babitz
Kelly Babitz on 6 Aug 2017
Commented: per isakson on 29 Sep 2017
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 Comments

Stephen Cobeldick
Stephen Cobeldick on 6 Aug 2017
"Kelly Babitz: please edit your question and show the complete error message . This means all of the red text.
per isakson
per isakson on 29 Sep 2017
The problem is that Matlab doesn't provide a "complete error message". (Caveat: as of R2016a at least)

Sign in to comment.

Answers (1)

Titus Edelhofer
Titus Edelhofer on 6 Aug 2017
Hi,
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 ...
Titus

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by