フィルターのクリア

Display plots as movie without pause()

2 ビュー (過去 30 日間)
Jettae Schroff
Jettae Schroff 2022 年 8 月 23 日
回答済み: Walter Roberson 2022 年 8 月 24 日
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 :)

回答 (2 件)

Chunru
Chunru 2022 年 8 月 24 日
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 2022 年 8 月 24 日
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

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by