matlab 生成 gif
matlab 生成 gif
figure;
for i = 1:circle
conArr = squeeze(r(i,:,:));
imagesc(conArr);
set(gcf,'colormap',jet);
caxis([3.0 3.5]);
colorbar;
F=getframe(gcf);
I=frame2im(F);
[I,map]=rgb2ind(I,256);
if i == 1
imwrite(I,map,['MI_' num2str(i*100) '_Nertwork.gif'],'gif', 'Loopcount',inf,'DelayTime',0.02);
else
imwrite(I,map,['MI_' num2str(i*100) '_Nertwork.gif'],'gif','WriteMode','append','DelayTime',0.02);
end
end
错误使用 wgifc 只能追加 GIF89a 格式的 GIF。
原来是文件名出错了(文件名里边不要有i这种变量)
figure;
for i = 1:circle
conArr = squeeze(r(i,:,:));
imagesc(conArr);
set(gcf,'colormap',jet);
caxis([3.0 3.5]);
colorbar;
F=getframe(gcf);
I=frame2im(F);
[I,map]=rgb2ind(I,256);
if i == 1
imwrite(I,map,['MI_' num2str(0) '_Nertwork.gif'],'gif', 'Loopcount',inf,'DelayTime',0.02);
else
imwrite(I,map,['MI_' num2str(0) '_Nertwork.gif'],'gif','WriteMode','append','DelayTime',0.02);
end
end
还有一种是生成avi视频