且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Matlab中将绘图另存为PNG

更新时间:2023-10-06 07:58:52

在Matlab中保存数字的另一种方法是使用变量处理它们并稍后保存它们。

Another way of saving figures in Matlab is handle them with variables and saving them later.

例如:

a=bar(...);
b=hist(...);   %some figures
c=plot(...);

saveas(a, 'path\to\file\abc1.png','png');
saveas(b, 'path\to\file\abc2.png','png');
saveas(c, 'path\to\file\abc3.png','png');






来自官方Matlab帮助的碎片:


Fragment from the official Matlab help:

saveas - 使用指定格式保存图形或Simulink框图

saveas - Save figure or Simulink block diagram using specified format

语法

saveas(h,'filename.ext') 
saveas(h,'filename','format')

描述

saveas(h,'filename.ext')将带有
句柄h的数字或Simulink框图保存到文件filename.ext。文件的格式由扩展名ext确定。 请参阅Matlab帮助了解更多信息。

saveas(h,'filename.ext') saves the figure or Simulink block diagram with the handle h to the file filename.ext. The format of the file is determined by the extension, ext. See Matlab help for more.