How can I print a plot or block diagram?
On this page:
MATLAB plots
The Matlab "print" command can be used either to print the current plot to a printer or to save the plot to a file.
The Matlab command:
>> print -Pprintername
will send the current plot to the printer "printername". If you have multiple plot windows, you can select the window to print with the "-fhandle" or "-fwindow_title" option. For example, to print Figure No. 2, you can use
>> print -f2
Simulink Block Diagrams
To print a Simulink block diagram, use the "-ssystem" option. For example, to print the Simulink block diagram entitled "f14"
>> print -sf14
will print it to the default printer. The command
>> print -dps filename.ps
will save the current plot to the file "filename.ps".
Multiple plots in a file
To save multiple plots in one file, use the "-append" option. For example, the following sequence shows how to save and print 3 plots in one file called "example.ps":
>> plot(sin([0:25]*2*pi/25)); >> print -dps example.ps >> plot(sin([0:25]*4*pi/25)); >> print -dps -append example.ps >> plot(sin([0:25]*8*pi/25)); >> print -dps -append example.ps
Then to print example.ps to the Pharos printers, use the lpr command at the athena prompt:
athena% lpr -Pmitprint example.ps
The "print" command supports a number of output types including:
-dps - PostScript for black and white printers -dpsc - PostScript for color printers -deps - Encapsulated PostScript (EPSF) -depsc - Encapsulated Color PostScript (EPSF)
Type "help print" at the Matlab prompt for more information on the options available for the print command.