Tuesday, April 1, 2008

How to create movie

countme=1;

figure;

for i = 1:n
x = Obj(i).x;
y = Obj(i).y;
plot(x,y,'o');
hold on
axis([-2 2 0 2]);

end
hold off
% ***************************************
% print(gcf, '-djpeg',['nnn',num2str(nest)])% this saves the pictures in jpeg format, with numbers in filename.
% **************************************
h=get(0,'CurrentFigure');
F(countme)=getframe(h);
F(countme)=getframe(gcf);
% **********************************
% save(['C:\academy\knuth\lighthouse\myWS', num2str(countme)]) % saves the work space without completion of loop
% ***********************************
countme=countme+1;
end

movie(F); % This is not working to create movie in my case.
% movie2avi(F,'movie');