Borrar filtros
Borrar filtros

Display plots as movie without pause()

2 visualizaciones (últimos 30 días)
Jettae Schroff
Jettae Schroff el 23 de Ag. de 2022
Respondida: Walter Roberson el 24 de Ag. de 2022
My program creates these plots. For simplicity, let's say it's sin(x)sin(y)*cos(t) - a sinusoidal graph in 2D which goes up and down through time. If I want to display this at a certain fps (let's say 10), I would do
t = 0
while true
plot( sin(x)sin(y)(cos(t) ) % this is just psudocode anyways, doesn't matter
pause(.1)
t = t + .1;
end
However, when I change pause(.1) to pause(.01) or even less, Matlab lags, and it doesn't respond when I try to close the figure, because it takes more then .1 seconds to do the calculation. Are there any alternatives to this? I've been struggling with this for awhile, so any help would be appreciated :)

Respuestas (2)

Chunru
Chunru el 24 de Ag. de 2022
t = 0
while true
plot( sin(x)sin(y)(cos(t) ) % this is just psudocode anyways, doesn't matter
%pause(.1)
drawnow % show the plot immediately
t = t + .1;
end

Walter Roberson
Walter Roberson el 24 de Ag. de 2022
You could pre-calulate the steps and store each one as an image, and then use https://www.mathworks.com/help/matlab/ref/movie.html

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by