|
"Steven_Lord" <slord@mathworks.com> wrote in message <isqh6f$nrk$1@newscl01ah.mathworks.com>...
>
>
> "Gianni Schena" <schena@univ.trieste.it> wrote in message
> news:isqcvc$bok$1@newscl01ah.mathworks.com...
> >
> > this is an old question on newsgroup
> > getframe + addframe used to save an avi file in a long loop slow down the
> > code ...
> > after adding say 300 frame the code is almost immobilized ... it is very
> > busy with addframe
>
> Are you certain that the problem is with ADDFRAME? Are you doing something
> along the lines of:
>
> hold on
> for k = 1:1000
> plot(x, y);
> myavifile(k) = getframe;
> end
>
> If so, each iteration through the loop adds an additional graphics object to
> the axes due to the HOLD ON; it is the number of graphics objects that
> MATLAB needs to display that's likely slowing your code down. Delete the
> lines you don't need or reuse them by using SET to change their XData and
> YData properties.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
I do something like
for k = 1:1000
imshow(...)
Fr = getframe();
my_avi=addframe(my_avi,fr)
%how TO FREE any POSSIBLE graphic obj. residual related to the use of HOLD ON ?
end
my_avi=close(...)
|