Mercurial > hg > octave-avbm
diff src/data.cc @ 8526:17e0ad741fac
reshape: improve error message
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 15 Jan 2009 14:58:49 -0500 |
parents | 81d6ab3ac93c |
children | 6b074f37e8d7 |
line wrap: on
line diff
--- a/src/data.cc +++ b/src/data.cc @@ -4537,10 +4537,12 @@ octave_value arg = args(0); - if (new_dims.numel () == arg.numel ()) - retval = (new_dims == arg.dims ()) ? arg : arg.reshape (new_dims); + dim_vector dims = arg.dims (); + + if (new_dims.numel () == dims.numel ()) + retval = (new_dims == dims) ? arg : arg.reshape (new_dims); else - error ("reshape: size mismatch"); + error ("reshape: size mismatch (%s != %s)", dims.str (), new_dims.str ()); return retval; }