儲存gif檔案.m,儲存gif.m

來源:互聯網
上載者:User

儲存gif檔案.m,儲存gif.m

filename=strcat('C:\Users\Public\Videos\Sample Videos\imw\imwrite\',int2str(i),'.','jpg');%將每禎轉成jpg的圖片搜尋clear;clc;figure %建立一張圖axis([0 5 0 2])%定義x軸(從0到5)和y軸的範圍(從0到2)for i=1:4    if i==1        text(i,1,'百','fontsize',40,'color','red');%i=1時,寫一個‘百’字    end    if i==2        text(i,1,'度','fontsize',40,'color','red');%i=2時,寫一個‘度’字    end    if i==3        text(i,1,'經','fontsize',40,'color','red'); %i=3時,寫一個‘經’字    end    if i==4        text(i,1,'驗','fontsize',40,'color','red');%i=4時,寫一個‘驗’字    end        picname=[num2str(i) '.fig'];%儲存的檔案名稱:如i=1時,picname=1.fig    hold on % 寫後面的字時,不把前面的字衝掉    saveas(gcf,picname)endstepall=4;for i=1:stepall    picname=[num2str(i) '.fig'];    open(picname)%     set(gcf,'outerposition',get(0,'screensize'));% matlab視窗最大化    frame=getframe(gcf);      im=frame2im(frame);%製作gif檔案,映像必須是index索引映像      [I,map]=rgb2ind(im,20);              if i==1        imwrite(I,map,'baidujingyan.gif','gif', 'Loopcount',inf,'DelayTime',0.5);%第一次必須建立!    elseif i==stepall        imwrite(I,map,'baidujingyan.gif','gif','WriteMode','append','DelayTime',0.5);    else        imwrite(I,map,'baidujingyan.gif','gif','WriteMode','append','DelayTime',0.5);    end;      close allend

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.