# HG changeset patch # User Rik # Date 1302573812 25200 # Node ID a3a7da1489b2c906631cb08e12edc3fd855fb7c7 # Parent 4727fd4dd4bba6e79efcd0df3bca80b951e17016 Modify func.txi discussion of output arguments to include discussion of isargout. diff --git a/doc/ChangeLog b/doc/ChangeLog --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-11 Rik + + * interpreter/func.txi: Add discussion of isargout to Ignoring + Arguments section of documentation. + 2011-04-07 Rik * interpreter/Makefile.am: Add spellcheck target to documentation diff --git a/doc/interpreter/func.txi b/doc/interpreter/func.txi --- a/doc/interpreter/func.txi +++ b/doc/interpreter/func.txi @@ -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