This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Why Does Accessing Tick Label Elements Return Error Message?

In R2014a and earlier, the XTickLabel, YTickLabel, and ZTickLabel properties of the axes contained the tick label values in either a character array or a cell array. Starting in R2014b, these properties always contain the tick labels in a cell array. Access elements of the array using cell array indexing with curly braces {}.

Using matrix indexing to access the elements returns an error message:

plot(0:10,0:10);
ax = gca;
xticks = get(ax,'XTickLabel');
xticks(1) = 'start';
Conversion to cell from char is not possible.
Use cell array indexing with curly braces {} to access tick label elements.
plot(0:10,0:10);
ax = gca;
xticks = get(ax,'XTickLabel');
xticks{1} = 'start';
set(ax,'XTickLabel',xticks) % set tick labels to updated values

See Also