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

15 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Alexander
Alexander am 17 Jan. 2013
Sorry just managed to solve this with:
filename=it; saveas(f3, num2str(it), 'png');
  2 Kommentare
Jesus
Jesus am 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 am 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Printing and Saving finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by