필터 지우기
필터 지우기

Making a MATLAB movie (AVI) including the axis

조회 수: 1 (최근 30일)
mathworks2011
mathworks2011 2011년 9월 9일
I want to make a movie file (avi) which when played back on a non-matlab PC includes the axis, titles etc.
h=figure;
movegui(h, 'onscreen');
title('MyTits')
vidObj = VideoWriter(myPathVid);
vidObj.Quality = 100;
open(vidObj);
data = randn(20,1);
for t = 1: 100
data(t) = rand(1);
h = plot(data);
datetick;
movegui(h, 'onscreen');
hold all;
drawnow;
currFrame = getframe;
writeVideo(vidObj,currFrame);
end
close(vidObj);
This creates the video and save it do disk.
However it only includes what goes on inside the axis.
How do I get it to include the axis?/ legends etc etc
I have tried the following but it doesnt work.
movegui(h, 'onscreen');
rect = get(h,'Position');
rect(1:2) = [0 0];
data = randn(20,1);
for t = 1: 100
data(t) = rand(1);
h = plot(data);
datetick;
movegui(h, 'onscreen');
hold all;
drawnow;
writeVideo(vidObj,getframe(h,rect));
end
close(vidObj);

채택된 답변

mathworks2011
mathworks2011 2011년 9월 9일
solved:
movegui(h, 'onscreen');
rect = get(h,'Position');
rect(1:2) = [0 0];
data = randn(20,1);
for t = 1: 100
data(t) = rand(1);
h = plot(data);
movegui(h, 'onscreen');
hold all;
datetick;
drawnow;
writeVideo(vidObj,getframe(gcf,rect));
end
close(vidObj);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Just for fun에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by