# HG changeset patch # User John W. Eaton # Date 1594209396 14400 # Node ID c318254c9f015514133501231bad44dbeae82810 # Parent ea5a632b255347234cf71ddc239666249252b01c accept and ignore undefined elements in matrix concatentation (bug #58695) * pt-tm-const.cc (tm_row_const::init, tm_const::init): Continue if an undefined element (or empty row) is found instead of returning early and producing an undefined row (or empty array). New tests. diff -r ea5a632b2553 -r c318254c9f01 libinterp/parse-tree/pt-tm-const.cc --- a/libinterp/parse-tree/pt-tm-const.cc Tue Jul 07 18:34:23 2020 -0400 +++ b/libinterp/parse-tree/pt-tm-const.cc Wed Jul 08 07:56:36 2020 -0400 @@ -171,7 +171,7 @@ octave_value tmp = elt->evaluate (tw); if (tmp.is_undefined ()) - return; + continue; if (tmp.is_cs_list ()) { @@ -318,7 +318,7 @@ } if (row.empty ()) - break; + continue; if (m_all_strings && ! row.all_strings_p ()) m_all_strings = false; @@ -927,4 +927,26 @@ %!assert (isnull ([;;])) %!assert (isnull ([;,;])) %!assert (isnull ([,;,;,])) + +## Undefined elements. +%!function my_undef () +%!endfunction +%! +%!shared es +%! es = struct ("a", {}); +%! +%!assert <58695> ([1, es.a, 3], [1, 3]) +%!assert <58695> ([1, my_undef(), 3], [1, 3]) +%! +%!assert <58695> ([es.a, es.a, 3], 3) +%!assert <58695> ([my_undef(), my_undef(), 3], 3) +%! +%!assert <58695> ([1; es.a; 3], [1; 3]) +%!assert <58695> ([1; my_undef(), 3], [1; 3]) +%! +%!assert <58695> ([es.a; es.a; 3], 3) +%!assert <58695> ([my_undef(); my_undef(); 3], 3) +%! +%!assert <58695> ([es.a; es.a; 3], 3) +%!assert <58695> ([my_undef(); my_undef(); 3], 3) */