MATLAB: Timer misbehaving in GUI after upgrade to 2017b

guihang-uphg1hg2performancetimer

Many years ago I wrote some GUIs for animating 3D marker data from motion capture. I was using 2009b at the time and I know the guis worked fine in 2010b. I recently tried to run one of them with 2017b, but the timer is not behaving correctly. It started to play, but seemed choppy and would not respond immediately to button commands after the timer was started. The more I tested it, and tested other GUIs that use the same code for setting and controlling the timer, the worse it seemed to get, to the point the timer would completely hang up. All my guis using the same timer code seem to be affected.
If I run a simple timer from the command window it works fine, so I'm perplexed.
Because no error is generated I'm not even sure where to look to try to solve this problem.
Is there something about Matlab2017b timer control behavior in a GUI (built with GUIDE) that would be different from older (2009b) versions?
Not sure it is important, but the 'TimerFcn' callback code has a global variable "frm" (index frame) for displaying the current position of markers that is also updated. This has never been a problem and I don't think it is causing this, but otherwise I'm not sure how else to pass an index to the TimerFcn.

Best Answer

Hello Chris,
The biggest (relevant to you) change that has happened in that time is a complete change to the graphics engine in R2014b. This has had a large impact on GUIs in general, and especially on GUIs developed before that release and being used in a later release. I suspect that the timer isn't the issue, but instead the graphics input or updates causing the slow down.
Can you divorce the old timer code from the GUI, and use it with some text-only function to eliminate the GUI from the equation? If it works fine, then I suspect the GUI has some issues from the compatibility or inefficiencies due to the new graphics engine.
I'd highly suggest checking out the "Additional Resources" at the bottom of the new graphics engine page to get some suggestions for optimizing graphics operations.
-Cam
Related Question