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 CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by