Bottom line is that MATLAB is effectively single-threaded. So if a long operation is currently executing, the timer callback will not get a chance to run, and according to the timer object properties (read about BusyMode
), will instead add the event to a queue which MATLAB will eventually go through when it first gets a chance..
From what I understand (this is my own speculation), MATLAB timers can interrupt execution in between statements, but NOT during a lengthy one.
So in theory it should run after 0.01 second, but there are no guarantees...
The documentation says the following:
Note: The specified execution time and the actual execution of a timer
can vary because timer objects work in the MATLAB single-threaded
execution environment. The length of this time lag is dependent on
what other processing MATLAB is performing. To force the execution of
the callback functions in the event queue, include a call to the
drawnow function in your code. The drawnow function flushes the event
queue.
There is also this note on another doc page:
Note: Callback function execution might be delayed if the callback involves a CPU-intensive task such as updating a figure.