69 : count (1), dv (0, 0), all_str (false),
70 all_sq_str (false), all_dq_str (false),
71 some_str (false), all_real (false), all_cmplx (false),
72 all_mt (true), any_cell (false), any_sparse (false),
73 any_class (false), all_1x1 (false),
74 first_elem_is_struct (false), class_nm (), ok (false)
78 : count (1), dv (0, 0), all_str (false), all_sq_str (false),
79 some_str (false), all_real (false), all_cmplx (false),
80 all_mt (true), any_cell (false), any_sparse (false),
81 any_class (false), all_1x1 (! row.empty ()),
82 first_elem_is_struct (false), class_nm (), ok (false)
142 if (
this != &x && rep != x.
rep)
144 if (rep && --rep->count == 0)
158 if (rep && --rep->count == 0)
165 bool empty (
void)
const {
return rep->empty (); }
167 size_t length (
void)
const {
return rep->length (); }
184 std::string
class_name (
void)
const {
return rep->class_nm; }
188 operator bool ()
const {
return (rep && rep->ok); }
190 iterator
begin (
void) {
return rep->begin (); }
191 const_iterator
begin (
void)
const {
return rep->begin (); }
193 iterator
end (
void) {
return rep->end (); }
194 const_iterator
end (
void)
const {
return rep->end (); }
208 else if (c1.empty ())
210 else if (c2.empty ())
212 else if (c1 ==
"class" || c2 ==
"class")
216 bool c1_is_int = (c1 ==
"int8" || c1 ==
"uint8"
217 || c1 ==
"int16" || c1 ==
"uint16"
218 || c1 ==
"int32" || c1 ==
"uint32"
219 || c1 ==
"int64" || c1 ==
"uint64");
220 bool c2_is_int = (c2 ==
"int8" || c2 ==
"uint8"
221 || c2 ==
"int16" || c2 ==
"uint16"
222 || c2 ==
"int32" || c2 ==
"uint32"
223 || c2 ==
"int64" || c2 ==
"uint64");
225 bool c1_is_char = (c1 ==
"char");
226 bool c2_is_char = (c2 ==
"char");
228 bool c1_is_double = (c1 ==
"double");
229 bool c2_is_double = (c2 ==
"double");
231 bool c1_is_single = (c1 ==
"single");
232 bool c2_is_single = (c2 ==
"single");
234 bool c1_is_logical = (c1 ==
"logical");
235 bool c2_is_logical = (c2 ==
"logical");
237 bool c1_is_built_in_type
238 = (c1_is_int || c1_is_char || c1_is_double || c1_is_single
241 bool c2_is_built_in_type
242 = (c2_is_int || c2_is_char || c2_is_double || c2_is_single
247 if (c1 ==
"struct" && c2 == c1)
249 else if (c1 ==
"cell" || c2 ==
"cell")
251 else if (c1_is_char && c2_is_built_in_type)
253 else if (c2_is_char && c1_is_built_in_type)
255 else if (c1_is_int && c2_is_built_in_type)
257 else if (c2_is_int && c1_is_built_in_type)
259 else if (c1_is_single && c2_is_built_in_type)
261 else if (c2_is_single && c1_is_built_in_type)
263 else if (c1_is_double && c2_is_built_in_type)
265 else if (c2_is_double && c1_is_built_in_type)
267 else if (c1_is_logical && c2_is_logical)
277 ::error (
"%s (%s vs %s)", msg, x.
str ().c_str (), y.
str ().c_str ());
284 std::string this_elt_class_nm
349 bool first_elem =
true;
376 do_init_element (tlst(i), first_elem);
380 do_init_element (tmp, first_elem);
384 if (any_cell && ! any_class && ! first_elem_is_struct)
406 else if ((! any_class) && (! dv.hvcat (this_elt_dv, 1)))
408 eval_error (
"horizontal dimensions mismatch", dv, this_elt_dv);
420 bool elt_changed =
false;
436 bool first_elem =
true;
453 else if (! dv.hvcat (this_elt_dv, 1))
470 : dv (0, 0), all_str (false), all_sq_str (false), all_dq_str (false),
471 some_str (false), all_real (false), all_cmplx (false),
472 all_mt (true), any_cell (false), any_sparse (false),
473 any_class (false), class_nm (), ok (false)
497 operator bool ()
const {
return ok; }
539 all_1x1 = ! tm.
empty ();
541 bool first_elem =
true;
542 bool first_elem_is_struct =
false;
564 if (tmp && ! tmp.
empty ())
606 if (any_cell && ! any_class && ! first_elem_is_struct)
627 std::string this_elt_class_nm = elt.
class_name ();
640 else if (all_str && dv.length () == 2
641 && this_elt_dv.
length () == 2)
645 if (this_elt_nc >
cols ())
647 dv(0) += this_elt_nr;
649 else if ((!any_class) && (!dv.hvcat (this_elt_dv, 0)))
651 eval_error (
"vertical dimensions mismatch", dv, this_elt_dv);
666 error (
"invalid number of output arguments for matrix list");
668 retval = rvalue1 (nargout);
676 if (! (all_dq_strings_p || all_sq_strings_p))
678 "concatenation of different character string types may have unintended consequences");
681 template<
class TYPE,
class T>
701 TYPE ra = octave_value_extract<TYPE> (*q);
706 if (! ra.is_empty ())
725 template<
class TYPE,
class T>
747 assert (static_cast<size_t> (result.
numel ()) == row.
length ());
751 result(i++) = octave_value_extract<T> (*q);
765 array_list[i] = octave_value_extract<TYPE> (*q);
775 single_type_concat<TYPE> (result, tmp);
779 template<
class TYPE,
class T>
808 sparse_list[i] = octave_value_extract<TYPE> (*q);
813 sparse_row_list[j] = stmp;
846 map_list[i] = octave_value_extract<MAP> (*q);
851 map_row_list[j] = mtmp;
865 single_type_concat<TYPE> (result, dv, tmp);
877 if (tmp.all_1x1_p ())
878 single_type_concat<octave_scalar_map> (result, dv, tmp);
880 single_type_concat<octave_map> (result, dv, tmp);
915 if (
rows.length () == 1)
935 bool frc_str_conv =
false;
939 if (tmp && ! tmp.
empty ())
958 else if (result_type ==
"double")
963 retval = do_single_type_concat<SparseMatrix> (dv, tmp);
965 retval = do_single_type_concat<SparseComplexMatrix> (dv, tmp);
970 retval = do_single_type_concat<NDArray> (dv, tmp);
972 retval = do_single_type_concat<ComplexNDArray> (dv, tmp);
975 else if (result_type ==
"single")
978 retval = do_single_type_concat<FloatNDArray> (dv, tmp);
980 retval = do_single_type_concat<FloatComplexNDArray> (dv, tmp);
982 else if (result_type ==
"char")
984 char type = all_dq_strings_p ?
'"' :
'\'';
990 single_type_concat<charNDArray> (result, tmp);
994 else if (result_type ==
"logical")
997 retval = do_single_type_concat<SparseBoolMatrix> (dv, tmp);
999 retval = do_single_type_concat<boolNDArray> (dv, tmp);
1001 else if (result_type ==
"int8")
1002 retval = do_single_type_concat<int8NDArray> (dv, tmp);
1003 else if (result_type ==
"int16")
1004 retval = do_single_type_concat<int16NDArray> (dv, tmp);
1005 else if (result_type ==
"int32")
1006 retval = do_single_type_concat<int32NDArray> (dv, tmp);
1007 else if (result_type ==
"int64")
1008 retval = do_single_type_concat<int64NDArray> (dv, tmp);
1009 else if (result_type ==
"uint8")
1010 retval = do_single_type_concat<uint8NDArray> (dv, tmp);
1011 else if (result_type ==
"uint16")
1012 retval = do_single_type_concat<uint16NDArray> (dv, tmp);
1013 else if (result_type ==
"uint32")
1014 retval = do_single_type_concat<uint32NDArray> (dv, tmp);
1015 else if (result_type ==
"uint64")
1016 retval = do_single_type_concat<uint64NDArray> (dv, tmp);
1017 else if (result_type ==
"cell")
1018 retval = do_single_type_concat<Cell> (dv, tmp);
1019 else if (result_type ==
"struct")
1062 q != row.
end (); q++)
1069 goto found_non_empty;
1086 int dv_len = dv.
length ();
1115 ra_idx (0) += row.
rows ();
1121 if (frc_str_conv && ! retval.
is_string ())
1137 new_matrix->
copy_base (*
this, scope, context);
1373 @deftypefn {Built-in Function} {@var{val} =} string_fill_char ()\n\
1374 @deftypefnx {Built-in Function} {@var{old_val} =} string_fill_char (@var{new_val})\n\
1375 @deftypefnx {Built-in Function} {} string_fill_char (@var{new_val}, \"local\")\n\
1376 Query or set the internal variable used to pad all rows of a character\n\
1377 matrix to the same length. It must be a single character. The default\n\
1378 value is @qcode{\" \"} (a single space). For example:\n\
1382 string_fill_char (\"X\");\n\
1383 [ \"these\"; \"are\"; \"strings\" ]\n\
1384 @result{} \"theseXX\"\n\
1390 When called from inside a function with the @qcode{\"local\"} option, the\n\
1391 variable is changed locally for the function and any subroutines it calls. \n\
1392 The original variable value is restored when exiting the function.\n\