Mercurial > hg > octave-terminal
changeset 4708:e5639a6586c4
[project @ 2004-01-22 17:59:28 by jwe]
author | jwe |
---|---|
date | Thu, 22 Jan 2004 17:59:28 +0000 |
parents | 8d4bb887f381 |
children | cf141edca935 |
files | liboctave/Array.cc |
diffstat | 1 files changed, 21 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -848,6 +848,14 @@ dim_vector dv_old = dimensions; + if (n > dv_old.length ()) + { + dv_old.resize (n); + + for (int i = dv_old.length (); i < n; i++) + dv_old.elem (i) = 1; + } + dimensions = dv; Array<int> ra_idx (dimensions.length (), 0); @@ -2239,22 +2247,22 @@ { dim_vector dv_tmp = rhs.squeeze().dims (); - if (dv_tmp.length () > 2) + switch (dv_tmp.length ()) { - (*current_liboctave_error_handler) - ("Dimension mismatch"); - - return 0; - } - - if (dv_tmp.length () == 1) - if (rhs_nr == 1) - rhs_nc = dv_tmp.elem (0); - - else if (dv_tmp.length () == 2) - { + case 1: + if (rhs_nr == 1) + rhs_nc = dv_tmp.elem (0); + break; + + case 2: rhs_nr = dv_tmp.elem (0); rhs_nc = dv_tmp.elem (1); + break; + + default: + (*current_liboctave_error_handler) + ("Array<T>::assign2: Dimension mismatch"); + return 0; } }