Mercurial > hg > octave-lyh
changeset 6401:f8cbc0871ed6
[project @ 2007-03-09 15:34:45 by dbateman]
author | dbateman |
---|---|
date | Fri, 09 Mar 2007 15:34:45 +0000 |
parents | 566343604d95 |
children | fe9817a6ee98 |
files | src/ChangeLog src/data.cc |
diffstat | 2 files changed, 23 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2007-03-09 David Bateman <dbateman@free.fr> + + * data.cc (do_cat): Also treat case of all empty matrices. + 2007-03-08 John W. Eaton <jwe@octave.org> * mex.cc (mxArray_octave_value::set_dimensions,
--- a/src/data.cc +++ b/src/data.cc @@ -746,26 +746,31 @@ } } - tmp = tmp.resize (dim_vector (0,0)).resize (dv); - - if (error_state) - return retval; - - Array<int> ra_idx (dv.length (), 0); - - for (int j = i; j < n_args; j++) + if (i == n_args) + retval = Matrix (); + else { - tmp = do_cat_op (tmp, args (j), ra_idx); + tmp = tmp.resize (dim_vector (0,0)).resize (dv); if (error_state) return retval; - dim_vector dv_tmp = args (j).dims (); - - ra_idx (dim) += (dim < dv_tmp.length () ? dv_tmp (dim) : 1); + Array<int> ra_idx (dv.length (), 0); + + for (int j = i; j < n_args; j++) + { + tmp = do_cat_op (tmp, args (j), ra_idx); + + if (error_state) + return retval; + + dim_vector dv_tmp = args (j).dims (); + + ra_idx (dim) += (dim < dv_tmp.length () ? dv_tmp (dim) : 1); + } + + retval = tmp; } - - retval = tmp; } else error ("%s: invalid dimension argument", fname.c_str ());