diff src/ov-str-mat.cc @ 5033:3dcc3824b732

[project @ 2004-09-24 04:26:07 by jwe]
author jwe
date Fri, 24 Sep 2004 04:26:07 +0000
parents 44046bbaa52c
children 55f5b61d74b7
line wrap: on
line diff
--- a/src/ov-str-mat.cc
+++ b/src/ov-str-mat.cc
@@ -39,6 +39,7 @@
 #include "oct-obj.h"
 #include "oct-stream.h"
 #include "ops.h"
+#include "ov-scalar.h"
 #include "ov-re-mat.h"
 #include "ov-str-mat.h"
 #include "gripes.h"
@@ -57,11 +58,21 @@
 static octave_value *
 default_numeric_conversion_function (const octave_value& a)
 {
+  octave_value *retval = 0;
+
   CAST_CONV_ARG (const octave_char_matrix_str&);
 
   NDArray nda = v.array_value (true);
 
-  return error_state ? 0 : new octave_matrix (nda);
+  if (! error_state)
+    {
+      if (nda.numel () == 1)
+	retval = new octave_scalar (nda(0));
+      else
+	retval = new octave_matrix (nda);
+    }
+
+  return retval;
 }
 
 type_conv_fcn