Printing and Exporting Figures with MATLAB | ![]() ![]() |
A MATLAB printer driver is code that formats your figure into instructions that your printer understands. This section contains an overview of different types of printer drivers, help on choosing a driver, and detailed information about the different types of drivers, including tips on using. Please refer to the appropriate section listed below.
If you do not indicate a specific printer driver, MATLAB uses the default driver specified in printopt.m
. The factory default driver depends on the platform.
Platform |
Factory Default Printer Driver |
Windows |
Black-and-white Windows |
UNIX |
Black-and-white Level II PostScript |
To specify the printer driver on a per figure basis, use:
print
command
To change the default driver for all figures, edit printopt.m
. See Changing the Default Device and Printing Command for instructions.
Changing the default driver is useful if you frequently use the same driver, or if you use the Windows Print dialog box, which does not enable you to set the driver.
Note Specifying the printer driver does not change the selected printer. See Selecting a Printer for more information on this. |
Using the Print Dialog Box to Specify a Driver (UNIX only)
To specify a printer driver for the current figure
Using the print Command to Specify a Driver
To specify a nondefault printer driver for the figure you are printing, include the device switch, -d
, with the print
command. This example prints the current figure using MATLAB's built-in Windows color printer driver.
Changing the Default Device and Printing Command
The printopt.m
file in your toolbox\local
directory defines two parameters used by the print
command. You can change these parameters by editing printopt.m
yourself. See Editing printopt.m for more information.
pcmd
- the command used by your operating system for all calls to print
dev
- the default printer driver or export file format for your platform
The print
command obtains the settings in printopt.m
using the command
This table shows the default values for pcmd
and dev
on each platform.
The value entered for pcmd
must be understood by your operating system.
The dev
value can be set to any driver supported by MATLAB. The default Windows driver, -dwin
, specifies black-and-white printing through the Windows Print Manager. The default UNIX driver,-dps2,
produces black and white Level 2 PostScript. For the full list values for dev
, see the "Drivers" section of the print
reference page.
Note
When MATLAB gets the default driver from printopt.m , it does not
distinguish between -dwin and -dwinc . See "How the Default Windows Driver
Is Handled for more information and workarounds.
|
Editing printopt.m
You or your system manager can edit the file printopt.m
, which is located in the toolbox\local
directory. If you are working on a multiuser system, you can make a copy of printopt.m
and place it on your search path ahead of the MATLAB version. To edit printopt.m
, enter the command
This command opens printopt.m
in your text editor. Scroll down about 40 lines until you come to this comment line.
Find the line below this that sets dev
. Replace the text string with an appropriate value. For example, to set the default device type to HP LaserJet III, modify the line to read,
For the full list values for dev
, see the "Drivers" section of the print
reference page.
![]() | Using the Print Dialog Box | Types of Printer Drivers | ![]() |