[ChangeSet] print.m: support for figure handles
Ben Abbott
bpabbott at mac.com
Fri Feb 29 09:05:49 CST 2008
I modified print.m to support a figure handle as an input.
It is a trivial change, but permits printing as is often done (by me) in Matlab. For example,
print (gcf, '-pdf', 'foo.pdf')
Please consider the attached changeset.
Ben
-------------- next part --------------
# HG changeset patch
# User Ben Abbott <bpabbott at mac.com>
# Date 1204297027 18000
# Node ID cebc5560d531bac7c10bc90cc955d1770d01f85d
# Parent b84c5cbc081243fabec4026636f0c947c587c372
print.m: Figure handle as argument.
diff -r b84c5cbc0812 -r cebc5560d531 scripts/ChangeLog
--- a/scripts/ChangeLog Fri Feb 29 04:09:03 2008 -0500
+++ b/scripts/ChangeLog Fri Feb 29 09:57:07 2008 -0500
@@ -1,3 +1,7 @@ 2008-02-29 John W. Eaton <jwe at octave.o
+2008-02-28 Ben Abbott <bpabbott at mac.com>
+
+ * plot/print.m: Modified to accept a figure handle as an optional input.
+
2008-02-29 John W. Eaton <jwe at octave.org>
* plot/print.m: Handle gif and jpg devices.
diff -r b84c5cbc0812 -r cebc5560d531 scripts/plot/print.m
--- a/scripts/plot/print.m Fri Feb 29 04:09:03 2008 -0500
+++ b/scripts/plot/print.m Fri Feb 29 09:57:07 2008 -0500
@@ -19,10 +19,14 @@
## -*- texinfo -*-
## @deftypefn {Function File} {} print (@var{filename}, @var{options})
+## @deftypefnx {Function File} {} print (@var{h}, @var{filename}, @var{options})
## Print a graph, or save it to a file
##
## @var{filename} defines the file name of the output file. If no
## filename is specified, output is sent to the printer.
+##
+## @var{h} specifies the figure handle. If no handle is specified
+## the handle for the current figure is used.
##
## @var{options}:
## @table @code
@@ -184,8 +188,10 @@ function print (varargin)
elseif (length (arg) > 0)
name = arg;
endif
+ elseif (ishandle (arg))
+ figure (arg);
else
- error ("print: expects string options");
+ error ("print: inputs must be string options, or a figure handle.");
endif
endfor
More information about the Octave-maintainers
mailing list