Saving multiple images from a plot which updates with each iteration of a loop

15 ビュー (過去 30 日間)
Hi,
I have a plot inside a loop which updates with each iteration of the loop. I would like to save each of the "updates" as a separate .gif (or similar) inorder to produce an animation that can be played outside of matlab.
At present I am using the following to save an image:
saveas(h,'filename.ext')
Cheers,
Alex

採用された回答

Alexander
Alexander 2013 年 1 月 17 日
Sorry just managed to solve this with:
filename=it; saveas(f3, num2str(it), 'png');
  2 件のコメント
Jesus
Jesus 2013 年 2 月 10 日
hi Alexander... im new on this topic of image processing and i have a similar problem:
i need to load->process->save and finally dsisplay a number of images but i dont know how to do it the only thing i have its the loading part so if you could help me would be awesome.
thanks dude!!!
Alexander
Alexander 2013 年 2 月 12 日
Hi, sorry for the late reply didn't see your comment. Not sure if I will be much help but here goes...
I managed to solve my problem with:
saveas(f1, num2str(it), 'png');
where: f1=name of my figure, it was the loop iteration and png is the file type
I managed to produce animated gifs using:
filename = 'test.gif';
frame = getframe(1);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if it == 1;
imwrite(imind,cm,filename,'gif', 'Loopcount',inf,'DelayTime',0.1);
else
imwrite(imind,cm,filename,'gif','WriteMode','append','DelayTime',0.1);
end
Hope that is of some help!
Alex

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by