saveas
Save figure to specific file format
Description
saveas( saves the
                figure or Simulink® block diagram specified by fig,filename)fig to file
                    filename. Specify the file name as a character vector or
                string that includes a file extension, for example, 'myplot.jpg'.
                The file extension defines the file format. If you do not specify an extension, then
                    saveas saves the figure to a FIG file. To save the current
                figure, specify fig as gcf.
saveas( creates
the file using the specified file format, fig,filename,formattype)formattype.
If you do not specify a file extension in the file name, for example, 'myplot',
then the standard extension corresponding to the specified format
automatically appends to the file name. If you specify a file extension,
it does not have to match the format. saveas uses formattype for
the format, but saves the file with the specified extension. Thus,
the file extension might not match the actual format used.
Examples
Input Arguments
Tips
- To control the size or resolution when you save a figure, use the - printfunction instead.
- The - saveasfunction and the Save As dialog box (accessed from the File menu) do not produce identical results. The Save As dialog box produces images at screen resolution and at screen size. The- saveasfunction uses a resolution of 150 DPI and uses the- PaperPositionand- PaperPositionModeproperties of the figure to determine the size of the image.
- Details of saved and printed figures can differ from the figure on the display. To get output that is more consistent with the display, see Export Figures for Use in Other Applications. 
Alternative Functionality
Use the exportgraphics function to save the contents of any axes, figure, chart
            that can be a child of a figure, tiled chart layout, or container such as a panel. This
            function provides a better alternative to the saveas function when
            you want to:
- Save graphics displayed in an app or in MATLAB Online™ 
- Minimize the white space around the content 
- Save a PDF fragment with embeddable fonts 
- Save a subset of the content in the figure 
- Control the background color without having to modify properties on the figure