changeset 12592:732a568bf694 stable

Modify func.txi discussion of output arguments to include discussion of isargout.
author Rik <octave@nomad.inbox5.com>
date Mon, 11 Apr 2011 19:03:32 -0700
parents c3d4542a4f06
children 47417d37c4db
files doc/ChangeLog doc/interpreter/func.txi
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog	Sun Apr 10 11:46:50 2011 -0400
+++ b/doc/ChangeLog	Mon Apr 11 19:03:32 2011 -0700
@@ -1,3 +1,8 @@
+2011-04-11  Rik  <octave@nomad.inbox5.com>
+
+	* interpreter/func.txi: Add discussion of isargout to Ignoring
+	Arguments section of documentation.
+
 2011-04-07  Rik  <octave@nomad.inbox5.com>
 
 	* interpreter/Makefile.am: Add spellcheck target to documentation
--- a/doc/interpreter/func.txi	Sun Apr 10 11:46:50 2011 -0400
+++ b/doc/interpreter/func.txi	Mon Apr 11 19:03:32 2011 -0700
@@ -342,8 +342,6 @@
 
 @DOCSTRING(nargoutchk)
 
-@DOCSTRING(isargout)
-
 @anchor{doc-varargin} @anchor{doc-varargout}
 @node Variable-length Argument Lists
 @section Variable-length Argument Lists
@@ -456,6 +454,26 @@
 
 The value of @code{nargin} is not affected by using this declaration.
 
+Return arguments can also be ignored using the same syntax.  Functions may
+take advantage of ignored outputs to reduce the number of calculations
+performed.  To do so, use the @code{isargout} function to query whether the
+output argument is wanted.  For example:
+
+@example
+@group
+function [out1, out2] = long_function (x, y, z)
+  if (isargout (1))
+    ## Long calculation
+    @dots{}
+    out1 = result;
+  endif
+  @dots{}
+endfunction
+@end group
+@end example
+
+@DOCSTRING(isargout)
+
 @node Variable-length Return Lists
 @section Variable-length Return Lists
 @cindex variable-length return lists