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

15 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Alexander
Alexander le 17 Jan 2013
Sorry just managed to solve this with:
filename=it; saveas(f3, num2str(it), 'png');
  2 commentaires
Jesus
Jesus le 10 Fév 2013
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 le 12 Fév 2013
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by