Mercurial > hg > octave-nkf
changeset 6561:dc83c15d7149
[project @ 2007-04-23 16:58:17 by jwe]
author | jwe |
---|---|
date | Mon, 23 Apr 2007 16:58:17 +0000 |
parents | 03ff4e32c895 |
children | 82d0132889e4 |
files | src/ChangeLog src/data.cc |
diffstat | 2 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2007-04-23 Soren Hauberg <soren@hauberg.org> + + * data.cc (Fsize_equal): Allow more than two arguments. + 2007-04-20 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/__gnuplot_raw__.l (deftypefn):
--- a/src/data.cc +++ b/src/data.cc @@ -1099,23 +1099,34 @@ DEFUN (size_equal, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} size_equal (@var{a}, @var{b})\n\ -Return true if the dimensions of @var{a} and @var{b} agree.\n\ +@deftypefn {Built-in Function} {} size_equal (@var{a}, @var{b}, @dots{})\n\ +Return true if the dimensions of all arguments agree.\n\ Trailing singleton dimensions are ignored.\n\ @seealso{size, numel}\n\ @end deftypefn") { octave_value retval; - if (args.length () == 2) + int nargin = args.length (); + + if (nargin >= 2) { + retval = true; + dim_vector a_dims = args(0).dims (); - dim_vector b_dims = args(1).dims (); - a_dims.chop_trailing_singletons (); - b_dims.chop_trailing_singletons (); - - retval = a_dims == b_dims; + + for (int i = 1; i < nargin; ++i) + { + dim_vector b_dims = args(i).dims (); + b_dims.chop_trailing_singletons (); + + if (a_dims != b_dims) + { + retval = false; + break; + } + } } else print_usage ();