changeset 21261:f982cfe3df03

When concatenating cells, suppress empty matrices (bug #43511). * pt-mat.cc (cellify): Replace [] by {}, not by {[]}. * __patch__.m: Change concatenation to guarantee reproducibility.
author Lachlan <lachlanbis@gmail.com>
date Tue, 26 Jan 2016 15:52:21 +1100
parents e5cf0a9df3a2
children cf2eae837cc8
files libinterp/parse-tree/pt-mat.cc scripts/plot/draw/private/__patch__.m
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-mat.cc	Sun Feb 14 13:48:06 2016 -0800
+++ b/libinterp/parse-tree/pt-mat.cc	Tue Jan 26 15:52:21 2016 +1100
@@ -427,7 +427,10 @@
         {
           elt_changed = true;
 
-          *p = Cell (*p);
+          if (p->is_empty ())
+            *p = Cell ();
+          else
+            *p = Cell (*p);
         }
     }
 
@@ -1383,5 +1386,7 @@
 %! string_fill_char (orig_val);
 %! assert (string_fill_char (), orig_val);
 
+%!assert ( [ [], {1} ], {1} )
+
 %!error (string_fill_char (1, 2))
 */
--- a/scripts/plot/draw/private/__patch__.m	Sun Feb 14 13:48:06 2016 -0800
+++ b/scripts/plot/draw/private/__patch__.m	Tue Jan 26 15:52:21 2016 +1100
@@ -42,7 +42,7 @@
       fvc = cell (1, 2*numfields (fvs));
       fvc(1:2:end) = fieldnames (fvs);
       fvc(2:2:end) = struct2cell (fvs);
-      args = [fvc{:}, varargin(2:end)];
+      args = [fvc(:)', varargin(2:end)];
     else
       failed = true;
     endif