diff src/ov-struct.cc @ 5444:781c9e7dbb73

[project @ 2005-09-08 02:55:21 by jwe]
author jwe
date Thu, 08 Sep 2005 02:56:01 +0000
parents 2f51d6d65fb2
children 6bf56668b01a
line wrap: on
line diff
--- a/src/ov-struct.cc	Thu Sep 08 01:40:58 2005 +0000
+++ b/src/ov-struct.cc	Thu Sep 08 02:56:01 2005 +0000
@@ -519,11 +519,16 @@
 
   int nargin = args.length ();
 
-  // struct([]) returns an empty struct.
-  // XXX FIXME XXX should struct() also create an empty struct?
+  // struct ([]) returns an empty struct.
+
+  // struct (empty_matrix) returns an empty struct with the same
+  // dimensions as the empty matrix.
+
+  // Note that struct () creates a 1x1 struct with no fields for
+  // compatibility with Matlab.
 
   if (nargin == 1 && args(0).is_empty () && args(0).is_real_matrix ())
-    return octave_value (Octave_map ());
+    return octave_value (Octave_map (args(0).dims ()));
     
   // Check for "field", VALUE pairs.