Matlab app designer gets stuck when enlarging figure (dynamic simulation)
Show older comments
I am using Matlab app designer to build a PID control simulator of different dynamic systems. The problem that I have is that when I enlarge figure to plot the progress of the control loop the app gets stuck, but when I keep the figure small (after dragging and dropping it without making it large) the app runs smoothly and without any problem.
Do you have an idea/solution why enlarging the figure causes the app to get stuck ?

Answers (1)
Bruno Luong
on 19 Jul 2020
When you enlarge the figure, a resize function is called to update and propagate the new size to various graphic object.
This is decide by the MATLAB "thread scheduller". My guess is your simulation is considered as priority and never yield hand to graphic resize.
Worl around: Try to add
drawnow
command now and then, for example every n-iteration of whatever the simulation loop. Something at a frequency of about 1-10Hz would be fine I guess, without much speed penalty of your simulation.
6 Comments
Fethi Belkhir
on 19 Jul 2020
Edited: Fethi Belkhir
on 19 Jul 2020
Bruno Luong
on 19 Jul 2020
Edited: Bruno Luong
on 19 Jul 2020
What happens if you run your code with the editor open, then while it's runing add a breakpoint for example at the line of "drawnow"?
I have seen similar odd things on my side that in some older MATLAB version that have been solved recently. It seems to me like MATLAB bug.
Fethi Belkhir
on 19 Jul 2020
Bruno Luong
on 19 Jul 2020
See if your graph get updated (sorry I forgot to say you change the App figure size before adding the breakpoint)
Fethi Belkhir
on 19 Jul 2020
Bruno Luong
on 19 Jul 2020
Edited: Bruno Luong
on 19 Jul 2020
Odd. How do you do to obtain the screen shot pic.png? I though you would simply do the same (using the mouse to drag window right side border on the right) ?
Nevermind if you cannot do it.
Do you inspect/set 'AutoResizeChildren' property of the axe container to ON?
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!