Unable to update plot in app designer
Mostrar comentarios más antiguos
I am trying to update a plot in app designer within a for loop. The plot is only ploting the last result of the loop after the loop is finished. I am using a push button to start the loop. I am using drawnow but it is not working. Here is my code. I am using R2019b. Please help in out from this. Thanks.

3 comentarios
Walter Roberson
el 4 de Jul. de 2020
I do not know the reason for the problem at the moment.
I would, however, suggest that it is typically better to create the line objects before a loop, and then update the line objects within the loop, instead of calling plot() each time.
L1 = plot(app.UIAxes, nan,nan);
L2 = plot(app.UIAxes, nan, nan, '.g');
for i = 1 : n
%stuff
L1.XData = A; L1.YData = B;
L2.XData = x1; L2.YData = x2;
drawnow();
pause(0.5);
end
Saurabh Chaudhary
el 5 de Jul. de 2020
Saurabh Chaudhary
el 6 de Jul. de 2020
Respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!