MATLAB movie2avi无法制作视频

时间:2015-10-28 09:08:06

标签: matlab video matlab-figure avi movie

我正在尝试使用R2014a中的简单代码测试函数movie2avi,如下所示:

clear; close all;
figure;
Z = peaks;
surf(Z);
axis tight manual;
ax = gca;
ax.NextPlot = 'replaceChildren';

loops = 40;
F(loops) = struct('cdata',[],'colormap',[]);
for j = 1:loops
    X = sin(j*pi/10)*Z;
    surf(X,Z);
    drawnow;
    F(j) = getframe(gcf);
end

movie(F);

movie2avi(F, 'myPeaks.avi', 'compression', 'None');

看起来电影(F)效果很好,但创建的avi文件包含工具栏和背景,而不仅仅是显示图形。此外,AVI文件只显示静止图片如下:

enter image description here

使用quicktime打开它会产生相同的结果:

https://www.dropbox.com/s/fd8vw7jvll5xkpw/b.png?dl=0

还有一个警告: 警告:结构字段分配使用类" double"覆盖值。请参阅MATLAB R14SP2发行说明,分配非结构 变量作为结构显示警告,以获取详细信息。

请帮忙。感谢。

1 个答案:

答案 0 :(得分:1)

你试过吗

F(j) = getframe(gca); %// Gets the current axis 

这将捕获轴而不是整个图形窗口。