Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 432
Tim Avatar asked Mar 21 '10 16:03

Tim


People also ask

Can you save a MATLAB plot as a JPEG image?

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.

What is print function in MATLAB?

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.

How do you print a plot in MATLAB?

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.

How do I save a high quality plot in MATLAB?

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 .


2 Answers

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."

like image 92
yuk Avatar answered Oct 26 '22 19:10

yuk


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.

like image 39
Michael Kopinsky Avatar answered Oct 26 '22 18:10

Michael Kopinsky