From: Justin on
I am plotting some data from a file, and stringing together the frames to form a movie. I am also computing the contour of a function, and plotting it in every frame. Unfortunately, this tends to slow down the generation of the movie considerably.

The function whose contour I am finding isn't changing, so it isn't necessary to compute it every time. Is it possible to "cache" the contour plot and just redisplay it every frame?

The code in question is shown below:

http://pastebin.com/XW0qHCpm
From: Steven Lord on

"Justin " <eldridgejm+matlab(a)gmail.com> wrote in message
news:i0jp2f$kb8$1(a)fred.mathworks.com...
>I am plotting some data from a file, and stringing together the frames to
>form a movie. I am also computing the contour of a function, and plotting
>it in every frame. Unfortunately, this tends to slow down the generation of
>the movie considerably.
> The function whose contour I am finding isn't changing, so it isn't
> necessary to compute it every time. Is it possible to "cache" the contour
> plot and just redisplay it every frame?

Why are you redisplaying the contour each time? Move your CONTOUR call
outside the loop, then add an output argument to each of your SCATTER calls
(which will contain the handle(s) of the graphics object(s) SCATTER created)
and DELETE the scatter plots after you've captured the image using GETFRAME.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com