Mercurial > hg > octave-lyh
changeset 4436:689f730954b3
[project @ 2003-06-24 13:00:12 by jwe]
author | jwe |
---|---|
date | Tue, 24 Jun 2003 13:00:12 +0000 |
parents | dd7af4fa1942 |
children | 0a59e4de215e |
files | src/ChangeLog src/ov-base-mat.cc src/ov-base.cc |
diffstat | 3 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2003-06-24 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-base.cc (octave_base_value::subsasgn): Also allow type + conversion for empty numeric objects with more than one index. + * ov-base-mat.cc (octave_base_matrix<T>::subsasgn): Likewise. + 2003-06-23 John W. Eaton <jwe@bevo.che.wisc.edu> * variables.cc (do_who): New arg, return_list. If return_list is
--- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -79,6 +79,17 @@ { if (type.length () == 1) retval = numeric_assign (type, idx, rhs); + else if (is_empty ()) + { + // Allow conversion of empty matrix to some other type in + // cases like + // + // x = []; x(i).f = rhs + + octave_value tmp = octave_value::empty_conv (type, rhs); + + retval = tmp.subsasgn (type, idx, rhs); + } else { std::string nm = type_name ();
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -114,6 +114,17 @@ { if (type.length () == 1) retval = numeric_assign (type, idx, rhs); + else if (is_empty ()) + { + // Allow conversion of empty matrix to some other + // type in cases like + // + // x = []; x(i).f = rhs + + octave_value tmp = octave_value::empty_conv (type, rhs); + + retval = tmp.subsasgn (type, idx, rhs); + } else { std::string nm = type_name ();