changeset 16841:2ce1ddead134

Return a cellstr column vector for ticklabels (bug #34906). * libinterp/interpfcn/graphics.cc(convert_ticklabel_string): Check for cellstr row vector input and reshape it to column vector.
author Rik <rik@octave.org>
date Mon, 24 Jun 2013 16:34:19 -0700
parents 969233a27bce
children 035b5fe157ad
files libinterp/interpfcn/graphics.cc
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/graphics.cc
+++ b/libinterp/interpfcn/graphics.cc
@@ -2078,7 +2078,7 @@
 %! xticklabel = get (gca (), "xticklabel");
 %! assert (class (xticklabel), "char");
 %! assert (size (xticklabel), [6, 3]);
-%!xtest
+%!test
 %! set (gcf (), "visible", "off");
 %! set (gca (), "xticklabel", {"0", "0.2", "0.4", "0.6", "0.8", "1"});
 %! xticklabel = get (gca (), "xticklabel");
@@ -5748,7 +5748,13 @@
 {
   octave_value retval = val;
 
-  if (!val.is_cellstr ())
+  if (val.is_cellstr ())
+    {
+      // Always return a column vector for Matlab Compatibility
+      if (val.columns () > 1)
+        retval = val.reshape (dim_vector (val.numel (), 1));
+    }
+  else
     {
       string_vector str;
       if (val.is_numeric_type ())
@@ -5784,8 +5790,8 @@
           ch(i) = ' ';
 
       retval = octave_value (ch);
-
-    }
+    }
+
   return retval;
 }