diff src/ov-base-mat.cc @ 4436:689f730954b3

[project @ 2003-06-24 13:00:12 by jwe]
author jwe
date Tue, 24 Jun 2003 13:00:12 +0000
parents fc9a075d10fb
children 7afd4bf05aa8
line wrap: on
line diff
--- 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 ();