Mercurial > hg > octave-nkf
changeset 5130:3bf4c0cd775d
[project @ 2005-02-08 03:01:13 by jwe]
author | jwe |
---|---|
date | Tue, 08 Feb 2005 03:01:13 +0000 |
parents | 9171ba7831d0 |
children | 89cddd966068 |
files | src/ChangeLog src/DLD-FUNCTIONS/find.cc |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-02-07 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/find.cc (find_nonzero_elem_idx): Return [] instead + of [](1x0) for scalar arg of zero. + 2005-02-06 John W. Eaton <jwe@octave.org> * DLD-FUNCTIONS/gplot.l (tmp_files): Delete.
--- a/src/DLD-FUNCTIONS/find.cc +++ b/src/DLD-FUNCTIONS/find.cc @@ -52,15 +52,20 @@ } // If the original argument was a row vector, force a row vector of - // the overall indices to be returned. + // the overall indices to be returned. But see below for scalar + // case... int result_nr = count; int result_nc = 1; + bool scalar_arg = false; + if (nda.ndims () == 2 && nda.rows () == 1) { result_nr = 1; result_nc = count; + + scalar_arg = (nda.columns () == 1); } Matrix idx (result_nr, result_nc); @@ -105,6 +110,8 @@ } } } + else if (scalar_arg) + val.resize (dim_vector (0, 0)); switch (nargout) {