Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
5032:3361e0846469 | 5033:3dcc3824b732 |
---|---|
37 #include "mx-base.h" | 37 #include "mx-base.h" |
38 | 38 |
39 #include "oct-obj.h" | 39 #include "oct-obj.h" |
40 #include "oct-stream.h" | 40 #include "oct-stream.h" |
41 #include "ops.h" | 41 #include "ops.h" |
42 #include "ov-scalar.h" | |
42 #include "ov-re-mat.h" | 43 #include "ov-re-mat.h" |
43 #include "ov-str-mat.h" | 44 #include "ov-str-mat.h" |
44 #include "gripes.h" | 45 #include "gripes.h" |
45 #include "pr-output.h" | 46 #include "pr-output.h" |
46 #include "pt-mat.h" | 47 #include "pt-mat.h" |
55 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char"); | 56 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char"); |
56 | 57 |
57 static octave_value * | 58 static octave_value * |
58 default_numeric_conversion_function (const octave_value& a) | 59 default_numeric_conversion_function (const octave_value& a) |
59 { | 60 { |
61 octave_value *retval = 0; | |
62 | |
60 CAST_CONV_ARG (const octave_char_matrix_str&); | 63 CAST_CONV_ARG (const octave_char_matrix_str&); |
61 | 64 |
62 NDArray nda = v.array_value (true); | 65 NDArray nda = v.array_value (true); |
63 | 66 |
64 return error_state ? 0 : new octave_matrix (nda); | 67 if (! error_state) |
68 { | |
69 if (nda.numel () == 1) | |
70 retval = new octave_scalar (nda(0)); | |
71 else | |
72 retval = new octave_matrix (nda); | |
73 } | |
74 | |
75 return retval; | |
65 } | 76 } |
66 | 77 |
67 type_conv_fcn | 78 type_conv_fcn |
68 octave_char_matrix_str::numeric_conversion_function (void) const | 79 octave_char_matrix_str::numeric_conversion_function (void) const |
69 { | 80 { |