How can I animate my plot?
11 ビュー (過去 30 日間)
古いコメントを表示
x=randn(2,10000); a=x(1,:); b=x(2,:); figure;plot(a,b,'.')
1 件のコメント
Chad Greene
2017 年 6 月 8 日
comet(a,b)
produces an animation. If you want a more specific solution, you'll have to ask a more specific question.
採用された回答
KSSV
2017 年 6 月 9 日
x=randn(2,10000);
a=x(1,:);
b=x(2,:);
% figure;
% plot(a,b,'.')
figure(1)
axis([min(a) max(a) min(b) max(b)])
hold on
filename = 'test.gif';
for n = 1:length(a)
plot(a(n),b(n),'.')
drawnow
frame = getframe(1);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if n == 1;
imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
else
imwrite(imind,cm,filename,'gif','WriteMode','append');
end
end
3 件のコメント
winkmal
2020 年 11 月 4 日
Nice, but I think 100 (instead of 1e5) points is enough for demonstration purposes. 😉 Otherwise, file grows > 125 MB!
Any chance to have the different layers appear on click, instead of after a fixed time? That would be useful for embedding in presentations.
KSSV
2020 年 11 月 5 日
I didn't get your question @rotton. Any example? So that we can undestand it with ease.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!