Matlab有以下制作AVI格式电影的指南。我的目标是能够通过PowerPoint在演示中播放视频。
nFrames = 20;
% Preallocate movie structure.
mov(1:nFrames) = struct('cdata', [],...
'colormap', []);
% Create movie.
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
for k = 1:nFrames
surf(sin(2*pi*k/20)*Z,Z)
mov(k) = getframe(gcf);
end
% Create AVI file.
movie2avi(mov, 'myPeaks.avi', 'compression', 'None');
我理解这个例子,并且知道我不应该在导入PowerPoint时进行压缩。 但是,我不知道如何使用结构正确地预分配内存。