我想知道在matlab中将绘图保存到图像文件时,saveas和print有什么区别?什么情况下两者都可以用,什么情况下只能用一个?
谢谢并恭祝安康!
我相信 SAVEAS 只是 PRINT 的包装。查看 SAVEAS(编辑 saveas)的源代码 - 大量参数检查,最后只有一个打印行。这两个函数都支持相同的格式。SAVEAS 的语法更简单一些。
来自 SAVEAS 的评论:"If you want to control the size or resolution of figures saved in image (bitmapped) formats (such as BMP or JPG), use the print command."
打印在其他方面也更加灵活。查看文档页面以进行打印 - 您可以复制到剪贴板(例如使用“print -dmeta”),当然也可以打印到打印机。
请改用 hgexport,如下所示:
hgexport(gcf, 'figure1.jpg', hgexport('factorystyle'), 'Format', 'jpeg');
来源: http ://www.mathworks.com/support/solutions/en/data/1-1PT49C/index.html?product=SL&solution=1-1PT49C