Specifying the Figure or Model to Print (-f, -s)
By default, MATLAB takes the current figure (i.e., the value returned by gcf) as the window to print. To print a figure other than the current figure, use the -f option. Note that you must use this option if the figure's handle is hidden (i.e., its HandleVisibility property is set to off).
The syntax is:
print -fhandle
For example, this command prints the figure whose handle is 2, regardless of which figure is the current figure:
print -f2
The handle of a figure corresponds to the title of the window, so in the example above, MATLAB prints the figure in the window titled "Figure No. 2."
You can also pass the handle as a variable to the function form of print. For example:
h = figure; plot(1:4,5:8)
print(h)
To print the block diagram displayed in a Simulink window, use the -s option. The syntax is:
print -swindowtitle
For example, this command prints the Simulink window titled "f14":
print -sf14
If the window title includes any spaces, you can call the function form rather than the command form of print. For example, this command prints a Simulink window title "Thruster Control" to a file named thrstcon.ps, using the MATLAB Level 1 black and white PostScript driver:
print('-sThruster Control','-dps','thrstcon.ps')
You can omit the window title if you want to print the current system. Just use:
print -s
For information about issues specific to printing Simulink windows, see the Simulink documentation.
[ Previous | Help Desk | Next ]