|
Hi,
I'm using 'getframe' within a for loop to capture changes in
a plot to a movie. The figure is actually a simple function
called 'waveplot' (which I downloaded from www.casabook.org):
function waveplot(x,gain)
% function waveplot(x,gain)
[r,c]=size(x);
if nargin==1
gain=1;
end
if nargin==3
for i=1:r,
x(i,:)=x(i,:)/max(abs(x(i,:)));
end
end
m=max(max(x));
hold on;
n=max(15*gain*x(r,:)/m+r*10);
for i=r:-1:1,
xa=[1 1:c c 1];
ya=[0 5*gain*x(i,:)/m+i*10 0 0];
fill(xa,ya,'w');
end
hold off;
axis([1 c 0 n]);
% Code end
which basically plots rows of a matrix one above another (in
my case the outputs of a filterbank). The trouble is that
the very top row 'sticks' so that the results of previous
frames remain, but only on the top row. Of course,
standalone plotting does not produce this artefact. You can
see on the plot that the top row is still being plotted, but
remnants from previous frames remain stuck behind.
So my question is, is there a way to force a more
comprehensive redraw without closing and re-opening the
figure (which I tried and doesn't work)? The refresh
function does not solve the problem either (it is not strong
enough).
|