matlab导出动画gif
matlab导出动画gif
获取当前绘图窗口,一帧一帧的追加写入Gif图片即可
% Write to the GIF File 追加Gif图片
frame = getframe(h); % 获得当前画图窗口h
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256); %图片颜色转换256
filename = [\'aa\',num2str(1),\'.gif\'];%图片名称
if loop == 1
imwrite(imind,cm,filename,\'gif\', \'Loopcount\',inf,\'DelayTime\',0.2);
%有一些参数网上有说明 delaytime gif播放时间差
else
imwrite(imind,cm,filename,\'gif\',\'WriteMode\',\'append\',\'DelayTime\',0.2);
end
请发表评论