matlab练习程序,生成gif图片

最近想合成一个gif图片,很多网站提供的功能要vip,还是matlab简单些。

之前也有用到过这个功能,单独再拿出来记录一下。

matlab代码如下:

clear all;
close all;
clc;

for i=0:100
    A =imread(strcat(num2str(i),\'.png\'));
    [I,map]=rgb2ind(A,256);
    if(i==0)
        imwrite(I,map,\'test.gif\',\'DelayTime\',0.04,\'LoopCount\',Inf)
    else
        imwrite(I,map,\'test.gif\',\'WriteMode\',\'append\',\'DelayTime\',0.04)
    end
end