Borrar filtros
Borrar filtros

animation turns static in live scripts

4 visualizaciones (últimos 30 días)
feynman feynman
feynman feynman el 28 de Feb. de 2024
Comentada: feynman feynman el 12 de Abr. de 2024
I have the following code that works well in m files but not in live scripts because a figure pops up in a separate window and the other figure on the output panel in the live script becomes static. How to revise so that pause, continue and close buttons can control the figure on the output panel in the live script rather than in a separate window?
fig = figure;
pauseButton=uicontrol('Style','pushbutton',...
'String','pause','Position',[20 60 60 20],...
'Callback',@(src,event)uiwait);
continueButton=uicontrol('Style','pushbutton',...
'String','continue','Position',[20 40 60 20],...
'Callback',@(src,event)uiresume);
closeButton=uicontrol('Style','pushbutton',...
'String','close','Position',[20 20 60 20],...
'Callback',@(src,event)close);
for i=1:100
if ~ishandle(fig),break;end
plot(linspace(0,1),i*linspace(0,1))
title(['i=',num2str(i)]);pause(0.1);
end
  4 comentarios
Zinea
Zinea el 8 de Abr. de 2024
You can use the control buttons on the separate window itself to interact with the figure.
feynman feynman
feynman feynman el 12 de Abr. de 2024
But if the figure is in a separate window, it's not in live scripts and one cannot playback the animation?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Animation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by