MATLAB: X, y-ticks are not shown in avi animation

avi

Why x, y-ticks are not shown in avi animation? Animation is made using VideoWriter(), getframe, writeVideo() functions.
turn=0;
v=VideoWriter('test.avi');
open(v);
set(gca,'nextplot','replacechildren');
N=20;
xx(1:N)=0;
plot( (1:N),'o-' );grid on;ylim([-1.5,1.5]);
title(sprintf('turn %d',turn));
xlabel('address');
ylabel('amplitude');
axis tight manual
for turn=1:100
xx=sin(2*pi*(1:N)*0.1+2*pi*turn*0.01);
plot( (1:N),xx,'o-' );grid on;ylim([-1.5,1.5]);
title(sprintf('turn %d',turn));
legend( sprintf('turn:%d',turn) );
xlabel('address');
ylabel('amplitude');
frame=getframe;
writeVideo(v,frame);
end
close(v);

Best Answer

clc;
clear all ;
turn=0;
v=VideoWriter('test.avi');
open(v);
set(gca,'nextplot','replacechildren');
N=20;
xx(1:N)=0;
hfig = figure ;
h = plot( (1:N),xx,'o-' );grid on;ylim([-1.5,1.5]);
title(sprintf('turn %d',turn));
xlabel('address');
ylabel('amplitude');
% axis tight manual
for turn=1:100
xx=sin(2*pi*(1:N)*0.1+2*pi*turn*0.01);
set(h,'XData',(1:N),'YData',xx) ;
title(sprintf('turn %d',turn));
legend( sprintf('turn:%d',turn) );
xlabel('address');
ylabel('amplitude');
frame=getframe(hfig);
writeVideo(v,frame);
end
close(v);