MATLAB: How to add minor ticks to a graph

graphMATLABminorminortickticks

I would like to add minor ticks in between the major ticks. I would like to know if there is a function or a property which will allow me to do this.

Best Answer

There are three properties of axes that allow you to add minor ticks to the axes. They are:
Property NameProperty Values
------------- ---------------
XMinorTick[on,{off}]
YMinorTick[on,{off}]
ZMinorTick[on,{off}]
Below is an example of how to use them:
plot(1:10)
set(gca,'XMinorTick','on','YMinorTick','on')
It is not possible to specify the location of the minor tick marks. Refer to the related solution for a workaround.