Why x, y-ticks are not shown in avi animation?
1 view (last 30 days)
Show older comments
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);
0 Comments
Accepted Answer
KSSV
on 17 Mar 2017
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);
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!