Mercurial > hg > octave-nkf
changeset 10284:c3df189b1b15
more coding tips
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 09 Feb 2010 11:43:03 +0100 |
parents | b178769f31ca |
children | 22a7913bbeb5 |
files | doc/ChangeLog doc/interpreter/tips.txi |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2010-02-09 Jaroslav Hajek <highegg@gmail.com> + + * interpreter/tips.txi: More tips. + 2010-01-30 Jaroslav Hajek <highegg@gmail.com> * interpreter/expr.txi (Assignment): Document return value of
--- a/doc/interpreter/tips.txi +++ b/doc/interpreter/tips.txi @@ -221,7 +221,7 @@ @item Use @code{cellfun} intelligently. The @code{cellfun} function is a useful tool for avoiding loops. @xref{Processing Data in Cell Arrays}. -@code{cellfun} is often use with anonymous function handles; however, calling +@code{cellfun} is often used with anonymous function handles; however, calling an anonymous function involves an overhead quite comparable to the overhead of an m-file function. Passing a handle to a built-in function is faster, because the interpreter is not involved in the internal loop. For example: @@ -235,6 +235,11 @@ @end example @item +Octave includes a number of other functions that can replace common types of loops, +including @code{bsxfun}, @code{arrayfun}, @code{structfun}, @code{accumarray}. +These functions can take an arbitrary function as a handle. + +@item Avoid calling @code{eval} or @code{feval} excessively, because they require Octave to parse input or look up the name of a function in the symbol table.