Help to make a GIF of my animation

3 views (last 30 days)
ferne17
ferne17 on 15 Jun 2013
Hello, I have a presentation this week and I need to make a GIF of my animation, because It takes to many time to run the code in the middle of the presentation and I would prefer to show an animation and aboid any mistake.
My code is giant, aprox 1800 lines of code, so I don't want to bother you with that. I think the clue to make my GIF is in the for that create my animation and the last part of the code:
for h=1:100 . . . imagesc(cancha);pause(0.001); end
cancha is my matrix, with lenght aprox 40x40 and only integer numbers (-inf, inf)
if someone can help me that would be great. Greetings! PS: I'm trying to modelate an cellular automaton, so the code is huge because of the rules.
  1 Comment
ferne17
ferne17 on 15 Jun 2013
Edited: ferne17 on 15 Jun 2013
I solved this with an external program and the code result this:
for h=1:t .
.
.
G=imagesc(cancha);
pause(0.001);
hold on
Image = getframe;
P = frame2im(Image);
number = num2str(h);
extension = '.bmp';
filename = [number,extension];
imwrite(P,eval('filename'), 'bmp');
hold off
end (of the "for h")
With this you made "t" images "bmp", and after with this program: http://uwcem.ece.wisc.edu/downloadable/GaLE10.exe
Where you select the images bmp and press preview and you obtain a GIF. This probably wouldn´t be best way to do the GIF, but it's the only way I know. If someone knows another please tell me!

Sign in to comment.

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!