diff src/ov-struct.cc @ 9190:7a10410db2c6

[mq]: x
author Robert T. Short <rtshort@ieee.org>
date Fri, 08 May 2009 15:18:22 -0400
parents 961410931a4f
children c2248cc4821a
line wrap: on
line diff
--- a/src/ov-struct.cc	Thu May 07 18:01:48 2009 -0400
+++ b/src/ov-struct.cc	Fri May 08 15:18:22 2009 -0400
@@ -701,6 +701,8 @@
 Singleton cells and non-cell values are repeated so that they fill\n\
 the entire array.  If the cells are empty, create an empty structure\n\
 array with the specified field names.\n\
+\n\
+If the argument is an object, return the underlying struct.\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -715,6 +717,14 @@
   // Note that struct () creates a 1x1 struct with no fields for
   // compatibility with Matlab.
 
+  if (nargin == 1 && args(0).is_object ())
+    {
+      Octave_map m = args(0).map_value ();
+      retval = octave_value (new octave_struct (m));
+
+      return retval;
+    }
+
   if ((nargin == 1 || nargin == 2)
       && args(0).is_empty () && args(0).is_real_matrix ())
     {