Matlab 實現App Designer批量保存坐標軸上圖像
1. 代碼
1 new_f_handle=figure('visible','off'); 2 new_axes=copyobj(picture,new_f_handle); %picture是GUI界面繪圖的坐標系句柄 3 set(new_axes,'units','default','position','default'); 4 [filename,pathname,fileindex]=uiputfile({'*.jpg';'*.bmp'},'save picture as'); 5 if ~filename 6 return 7 else 8 file=strcat(pathname,filename); 9 switch fileindex %根據不同的選擇保存為不同的類型 10 case 1 11 print(new_f_handle,'-djpeg',file); 12 case 2 13 print(new_f_handle,'-dbmp',file); 14 end 15 end 16 delete(new_f_handle);
2. 說明
實際上是新建一個新的坐標圖形,將GUI復制到新的圖像上,輸出新的圖像,最后刪除新建的圖形句柄。
3.效果
本文為保持文章完整性可能使用了其他作者的文字,如果影響到您的權益,請與我聯系,謝謝理解! 轉載本文請注明出處,非作者授權不得用於商業用途。
轉載於:matlab GUI保存axes(坐標軸)上的圖像 - 靜世孔明 - 博客園 (cnblogs.com)