save plot into image file in matlab: difference between saveas and print

杀马特。学长 韩版系。学妹 提交于 2019-12-09 17:19:35

问题


I wonder when saving plot into image file in matlab, what is the difference between saveas and print? In what cases both can be used and in what cases only one can be used?

Thanks and regards!


回答1:


I believe SAVEAS is just a wrapper for PRINT. Look at the source code for SAVEAS (edit saveas) - a lot of argument checks and only one print line at the end. Both function supports the same formats. SAVEAS has a little easier syntax.

From the SAVEAS remarks: "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."




回答2:


Print is a lot more flexible in other ways as well. Look at the doc page for print - you can copy to the clipboard (e.g. with "print -dmeta") as well as, of course, printing to a printer.




回答3:


use hgexport instead, as follows:

hgexport(gcf, 'figure1.jpg', hgexport('factorystyle'), 'Format', 'jpeg');

source: http://www.mathworks.com/support/solutions/en/data/1-1PT49C/index.html?product=SL&solution=1-1PT49C



来源:https://stackoverflow.com/questions/2487692/save-plot-into-image-file-in-matlab-difference-between-saveas-and-print

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!