MATLAB: How to reset axis ticks to normal after I modify them

axisdatetickMATLAB

Suppose I have turned on datetick for a specific axis. Is there a way to turn off / reset the axis ticks to normal mode with 'set' commands?

Best Answer

You want to tell the axes to place the ticks wherever it thinks is best via the XTickMode property. You also want to tell the axes to decide automatically how to label those ticks using the XTickLabelMode property.
Here's the statement to do it:
set(gca, 'XTickMode', 'auto', 'XTickLabelMode', 'auto')
You can replace the call to gca with the axes handle if you have it. Of course you can set the YTickMode, ZTickMode, ect. properties if you applied datetick to the y- or z-axis.