문제

I have to do exactly what my title says. I have a figure with a subplot, for example 3-by-5. I want to take all different graph inside the subplot and make each one of them a frame (in this case, 15 different frames). I have tried different solution but nothing worked. For example I tried:

writerObj = VideoWriter('try.avi');
writerObj.FrameRate = 1;
open(writerObj);
h= figure(1);

for x=1:15
    hh=subplot(3,5, x);
    frame=getframe(hh);
    writeVideo(writerObj,frame);
end
close(writerObj);

Or I tried

writerObj = VideoWriter('try.avi');
writerObj.FrameRate = 1;
open(writerObj);
h= figure(1);
fig=gcf;
axesHandles = get(gcf,'children');
for x=1:15
    hh=subplot(3,5, x);
    frame=getframe(axesHandles(x));
    writeVideo(writerObj,frame);
end
close(writerObj);
도움이 되었습니까?

해결책

I believe that the issue has to do with the 'PlotBoxAspectRatioMode' property of your axes being set to 'auto' when they're first created. You'll need to specify your axis limits with axis or use of the other options. If it's suitable for your data, try specifying axis equal for each axis. Or maybe axis square.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top