Thread Subject: animation

Subject: animation

From: Yvonne

Date: 26 Aug, 2009 10:36:04

Message: 1 of 2

Hi,

I am trying to create an animation to look at images from some model runs. I am currently running it in a for loop:

for zz =150:200
figure;
p=pcolor(y,x,BATHY);set(p,'linestyle','none');c=colorbar;
g=get(c,'Ylabel');set(g,'String','Depth (m)');
set(c,'clim',[-2 2])
hold on
quiver(y(1:ns:end),x(1:ns:end),uvel(1:ns:end,1:ns:end),vvel(1:ns:end,1:ns:end),'AutoScaleFactor',1,'Color','k')
hold on
% [xx yy]=find(isnan(uvel)==1);
plot(yy*10,xx*10,'.w')
set(gca,'nextplot','replacechildren');
pause(0.1)
Image(zz) = getframe(gca);
end
movie(Image,50);%play the movie 50 times


and after running the m-file, there is always the error message :
??? Error using ==> movie
Movie contains uninitialized frames.

I am not sure what is the meaning of the error message. Is there anyway to only have 1 figure plotted out instead of 50 figures plotted out to look at the animation.

Thank you

Subject: animation

From: Daniel Armyr

Date: 2 Sep, 2009 06:46:02

Message: 2 of 2

> ??? Error using ==> movie
> Movie contains uninitialized frames.
>
> I am not sure what is the meaning of the error message.

The problem is that you run your for-loop from 150-200. Looking at your code, you make a movie with 150 uninitialized frames and then 50 that are initialized. You want ZZ to go from 1:50. If you then need to use the numbers 150:200 in your simulation, you add an offset to the 1:50.

>Is there anyway to only have 1 figure plotted out instead of 50 figures plotted out
>to look at the animation.
Yes. Remove the "figure;" line. And make sure you add a "hold off" at the end of the loop.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
animation in ma... joe 26 Aug, 2009 12:37:56
animation in ma... Sprinceana 26 Aug, 2009 08:55:19
animation Sprinceana 26 Aug, 2009 08:55:19
rssFeed for this Thread

Contact us at files@mathworks.com