Printing and Exporting Figures with MATLAB | ![]() ![]() |
Specifying Options
Most options for exporting are the same as for printing. For export-only options, see Table 4-1, Export Formats and Export-Only Options,.
This example exports the current figure to a TIFF file, at a resolution of 300 dots per inch, and omits any user interface controls.
print -dtiff -r300 -noui
To enable variable settings in an M-file, use the function form of print
. Here is an equivalent to the above example that takes variables.
resolution = '-r300'; format = '-dtiff'; option = '-noui'; print(renderer, format, option);
(option
could be set to an empty string if you want to include uicontrols.)
As with printing, use the -f
switch to specify a figure.
The -adobecset, -r, and -loose Options
The -adobecset
and -loose
options are only valid for Ghostscript formats. The resolution switch, -r
, can only be used for built-in MATLAB formats. The first column of Table 4-1, Export Formats and Export-Only Options, indicates which formats are supplied by Ghostscript and which are built-in MATLAB formats.
Format-Specific Options
Some options can only be used with specific formats.
Format |
Options |
EPS |
-tiff , -cmyk , -loose . See EPS Files. |
Ghostscript formats |
-loose , see Producing Uncropped Output-adobecset , see Early PostScript 1 Printers. |
JPEG |
-jpeg<nn> , see JPEG Files. |
Your choice of format directly influences the bit depth of the output file. See About Bit Depth.
![]() | Exporting Using MATLAB Commands | Exporting to a File Using MATLAB Commands | ![]() |