Re: [問題] 能不能將繪圖直接存成圖檔 但是不要顯 …

看板MATLAB作者 (懶洋洋)時間12年前 (2012/05/04 10:36), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
我參考了這邊文章 可是卻失敗了 請大家幫我看看問題出在哪裡 感激不盡 for tt1=1:5 for tt2=1:3 h=figure('Visible', 'off'); plot(Kt, AA, 'b', Kt, BB,'r--','linewidth' , 2); set(gca,'FontWeight','bold');set(gca,'FontSize',14); legend('AA','BB') xlabel('k_t'); ylabel('Output'); title(['Results ',th1,'nm, ',th2,'nm']); str1=sprintf('Output_%dnm_%dnm',vt1(tt1),vt2(tt2)); saveas(h,str1,'jpg'); saveas(h,str1,'bmp'); end end 出現錯誤訊息: Warning: Failed in CreateCompatibleBitmap, last error code 00000057 > In C:\Program Files\MATLAB\R2010a\toolbox\matlab\graphics\hardcopy.p>hardcopy at 21 In graphics\private\render at 143 In print at 291 In saveas at 155 ??? Error using ==> print at 339 Out of memory. Type HELP MEMORY for your options. Error in ==> saveas at 155 print( h, name, ['-d' dev{i}] ) ※ 引述《airjaguar (捷豹)》之銘言: : 我用回圈畫了好幾個圖 分別存成不同檔名的檔案 : 以下是我寫的程式碼的一部份 : g=figure, subplot(2,2,1);plot(ep,tp,'g');xlabel('en');ylabel('t+'), : subplot(2,2,2);plot(en,tn,'r');xlabel('en');ylabel('t-'), : subplot(2,2,3);plot(e0,t0,'k');xlabel('en');ylabel('t0'), : subplot(2,2,4);plot(ep,tp,'g');xlabel('en');ylabel('t+') : hold on : subplot(2,2,4);plot( en, tn,'r');xlabel('en');ylabel('t-') : % 以上是全部存在同一張圖片 : name = ['n=' int2str(n) 'd=' int2str(d) '.emf']; : saveas(g, name); : close(g); : 是可以成功的依據回圈(for n=1:4)產生好幾個圖檔 : 但是有兩個討人厭的地方 : 他會依照回圈在命令列重複顯示 g=1 好幾次 偏偏 ";" 不知道要加在哪裡 囧 : 再來還有一個問題就是 我希望他只要存成圖檔就好 : 可是他邊存 好像一定都會show出他當下在畫的圖 : 有人知道怎麼解決這兩個問題嗎?? : 感激不盡 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.193.32.62

05/04 12:41, , 1F
Out of memory 是不是圖太大了?
05/04 12:41, 1F

05/04 12:52, , 2F
看樣子也應該如同diva大說的
05/04 12:52, 2F

05/04 12:53, , 3F
我發生過 memory exhausted XD
05/04 12:53, 3F
文章代碼(AID): #1Feq2iQH (MATLAB)