Mercurial > hg > octave-max
diff src/data.cc @ 5164:57077d0ddc8e
[project @ 2005-02-25 19:55:24 by jwe]
author | jwe |
---|---|
date | Fri, 25 Feb 2005 19:55:28 +0000 |
parents | 9eab94f5fadf |
children | 23b37da9fd5b |
line wrap: on
line diff
--- a/src/data.cc +++ b/src/data.cc @@ -537,7 +537,7 @@ else { ColumnVector v = m.diag (); - if (v.capacity () > 0) + if (v.numel () > 0) retval = v; } } @@ -560,7 +560,7 @@ else { ComplexColumnVector v = cm.diag (); - if (v.capacity () > 0) + if (v.numel () > 0) retval = v; } } @@ -729,16 +729,26 @@ octave_value tmp; bool any_strings = false; bool all_strings = true; + bool first_non_empty_arg = true; for (int i = 1; i < n_args; i++) - if (args(i).is_string ()) - any_strings = true; - else - all_strings = false; - + if (! args (i).all_zero_dims ()) + { + if (first_non_empty_arg) + { + first_non_empty_arg = false; + tmp = args (i); + } + + if (args(i).is_string ()) + any_strings = true; + else + all_strings = false; + } + if (all_strings) tmp = octave_value (charNDArray (dv, Vstring_fill_char), true); else - tmp = args(1).resize (dim_vector (0,0)).resize (dv); + tmp = tmp.resize (dim_vector (0,0)).resize (dv); if (error_state) return retval;