フィルターのクリア

plot data dynamically in the figure

88 ビュー (過去 30 日間)
moulay
moulay 2014 年 3 月 23 日
Hi all!
SUPPOSE I WANT TO PLOT THIS VECTOR:
%A=[1 1 2 5 9 8 7 6 3];
i want to plot it like a movie (dynamically). i mean the first point shold be ploted after 0.5 second the snd point , and so on ........
is there any possibility in matlab to do this?
thank you all

回答 (2 件)

Daniela F. López Astorquiza
Daniela F. López Astorquiza 2020 年 6 月 23 日
Hi,
% code
h = animatedline('Marker','o');
A = [1 1 2 5 9 8 7 6 3];
B = [20 30 50 10 85 95 5 8 9];
for k = 1:length(A)
addpoints(h,A(k),B(k))
xlim([min(A) max(A)]);
ylim([min(B) max(B)]);
drawnow limitrate
pause(0.7)
end

Joseph Cheng
Joseph Cheng 2014 年 3 月 23 日
編集済み: Joseph Cheng 2014 年 3 月 23 日
The example for drawnow should be easy to adapt for your purposes. You can then insert the function pause(.5) into the for loop to wait the .5 seconds before the next point.
A=[1 1 2 5 9 8 7 6 3];
B=A(1);
h = plot(B,'YDataSource','B');
for k = 1:length(A)
B=A(1:k);
refreshdata(h,'caller')
drawnow
pause(.5)
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by