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

9 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Alexander
Alexander il 17 Gen 2013
Sorry just managed to solve this with:
filename=it; saveas(f3, num2str(it), 'png');
  2 Commenti
Jesus
Jesus il 10 Feb 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 il 12 Feb 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by