[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'XTickLabel' - different type from Matlab's
From: |
Michael Goffioul |
Subject: |
Re: 'XTickLabel' - different type from Matlab's |
Date: |
Sat, 26 Nov 2011 18:47:23 +0000 |
On Sat, Nov 26, 2011 at 5:49 PM, Ben Abbott <address@hidden> wrote:
> This looks like a subtle incompatibility to me. In both ML and Octave the
> following render identical results ...
>
> set (gca, 'xticklabel', [0, 0.2, 0.4, 0.6, 0.8, 1]
> xticklabel1 = get (gca, 'xticklabel');
> set (gca, 'xticklabel', '0|0.2|0.4|0.6|0.8|1')
> xticklabel2 = get (gca, 'xticklabel');
> set (gca, 'xticklabel', ['0 '; '0.2'; '0.4'; '0.6'; '0.8'; '1 '])
> xticklabel3 = get (gca, 'xticklabel');
> set (gca, 'xticklabel', {'0', '0.2', '0.4', '0.6', '0.8', '1'})
> xticklabel4 = get (gca, 'xticklabel');
> whos xticklabel1 xticklabel2 xticklabel3 xticklabel4
>
> ML uses the 3rd variant for the default xticklabel values., and Octave uses
> the 4th (1x6 cellstr)
>
> Each set() statement works in both Octave and ML. However, the resulting
> values returned by the get() are different.
>
> Octave returns ...
>
> Variables in the current scope:
>
> Attr Name Size Bytes Class
> ==== ==== ==== ===== =====
> xticklabel1 1x6 48 double
> xticklabel2 1x19 19 char
> xticklabel3 6x3 18 char
> xticklabel4 1x6 14 cell
>
> And ML ...
>
> Name Size Bytes Class Attributes
>
> xticklabel1 6x3 36 char
> xticklabel2 6x3 36 char
> xticklabel3 6x3 36 char
> xticklabel4 6x1 700 cell
>
> I see three differences.
>
> (1) The default xticklabel values for ML are char, and are cell (cellstr) for
> Octave.
>
> (2) ML converts the xticklabel with class double or char with "|" used as a
> delimiter to a char array. Octave returns the same class and format as was
> passed to set().
>
> (3) ML converts a cellstr column vector to a row vector.
>
> I've filed a bug report.
>
> https://savannah.gnu.org/bugs/index.php?34906
It would be interesting to check what's the behavior for other similar
properties, like axes::linestyleorder, uicontrol::string...
Michael.