# HG changeset patch # User jwe # Date 1132589627 0 # Node ID 4d52e637a72aa08d668d6e5a7b9c63d82bb134d6 # Parent b23c53f26aec2954b3cc7df0881c0a6a9b1b775d [project @ 2005-11-21 16:13:47 by jwe] diff -r b23c53f26aec -r 4d52e637a72a src/DLD-FUNCTIONS/cellfun.cc --- a/src/DLD-FUNCTIONS/cellfun.cc Mon Nov 21 16:01:24 2005 +0000 +++ b/src/DLD-FUNCTIONS/cellfun.cc Mon Nov 21 16:13:47 2005 +0000 @@ -38,24 +38,24 @@ DEFUN_DLD (cellfun, args, , " -*- texinfo -*-\n\ @deftypefn {Lodable Function} {} cellfun (@var{name}, @var{c})\n\ +@deftypefnx {Lodable Function} {} cellfun (\"size\", @var{c}, @var{k})\n\ @deftypefnx {Lodable Function} {} cellfun (\"isclass\", @var{c}, @var{class})\n\ -@deftypefnx {Lodable Function} {} cellfun (\"size\", @var{c}, @var{k})\n\ @deftypefnx {Lodable Function} {} cellfun (@var{func}, @var{c})\n\ \n\ Evaluate the function named @var{name} on the elements of the cell array\n\ -@var{c}. Elements in cell_array are passed on to the named function\n\ +@var{c}. Elements in @var{c} are passed on to the named function\n\ individually. The function @var{name} can be one of the functions\n\ \n\ @table @code\n\ @item isempty\n\ -Return 1 when for non empty elements and 0 for others.\n\ +Return 1 for empty elements.\n\ @item islogical\n\ Return 1 for logical elements.\n\ @item isreal\n\ Return 1 for real elements.\n\ @item length\n\ Return a vector of the lengths of cell elements.\n\ -@item dims\n\ +@item ndims\n\ Return the number of dimensions of each element.\n\ @item prodofsize\n\ Return the product of dimensions of each element.\n\ @@ -78,7 +78,8 @@ @end group\n\ @end example\n\ \n\ -@end deftypefn") +@end deftypefn\n\ +@seealso{isempty, islogical, isreal, length, ndims, numel, size, isclass}") { octave_value retval; @@ -106,13 +107,13 @@ name = args(0).string_value (); else { - error ("cellfun: first argument must be a string"); + error ("cellfun: first argument must be a string or function handle"); return retval; } if (! args(1).is_cell ()) { - error ("cellfun: second argument must be a cell"); + error ("cellfun: second argument must be a cell array"); return retval; } @@ -125,7 +126,7 @@ { boolNDArray result (f_args.dims ()); for (int count = 0; count < k ; count++) - result(count) = f_args.elem(count).is_empty(); + result(count) = f_args.elem(count).is_empty (); retval = result; } else if (name == "islogical") @@ -146,21 +147,21 @@ { NDArray result (f_args.dims ()); for (int count= 0; count < k ; count++) - result(count) = double (f_args.elem(count).numel ()); + result(count) = double (f_args.elem(count).length ()); retval = result; } else if (name == "ndims") { NDArray result (f_args.dims ()); for (int count = 0; count < k ; count++) - result(count) = double ((f_args.elem(count).dims ()).numel ()); + result(count) = double (f_args.elem(count).ndims ()); retval = result; } else if (name == "prodofsize") { NDArray result (f_args.dims ()); for (int count = 0; count < k ; count++) - result(count) = double ((f_args.elem(count).dims ()).numel ()); + result(count) = double (f_args.elem(count).numel ()); retval = result; } else if (name == "size") @@ -187,7 +188,7 @@ } } else - error ("Not enough argument for size"); + error ("not enough arguments for `size'"); } else if (name == "isclass") { @@ -201,7 +202,7 @@ retval = result; } else - error ("Not enough argument for isclass"); + error ("not enough arguments for `isclass'"); } else {