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!
Save Plots InteractivelyThe export button supports three image formats (PNG, JPEG, and TIFF), as well as PDF files, which can contain images or vector graphics, depending on the content in the axes.
print( filename , formattype ) saves the current figure to a file using the specified file format, such as print('BarPlot','-dpng') . If the file name does not include an extension, then print appends the appropriate one.
Click File > Print, select a printer, and click OK. The printer must be set up on your system. If you do not see a printer that is set up already, then restart MATLAB®. To print the figure programmatically, use the print function.
It is possible to increase the resolution of the plots obtained in MATLAB. On the Plot window ---- Click on <Edit> --> <Figure properties> --> <Export setup> --> <Rendering>. Then change the resolution to 300 or 600dpi. Then Click on Export and save as .
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."
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With