In R2010b, I can reset the tick labels to auto thru figure editor,
but I'd like to reset them to default programmatically
I tried
set(gca,'XTickLabel','auto')
But it displays 'auto' at each tick... Any hint ?
You need to set XTickLabelMode
to 'auto'
:
set(gca,'XTickLabelMode','auto')
Tick label modes are set to 'manual'
when you specify tick labels. So, you need to turn it back to 'auto'
.
OK, I finally found this way:
set(gca,'XTickLabel', num2str(get(gca,'XTick')'));
I read the ticks and transform them back to strings...
EDIT: note that this a workaround that happens to work if you don't zoom nor resize the figure, but which is not robust to zoom/resize because the XTickLabelMode remains 'manual' and thus the XTickLabel won't be updated when you zoom.
I added this answer because this is the first thing I found (and others might find too).
The reason why it is not the preferred way is more usefull than the answer itself, thus this edit.
The right solution to do it, is the one that I accepted.