MATLAB: Is it possible to display XMinorTick marks only on the bottom axis of the plot and not the top in MATLAB 7.6 (R2008a)

axiscontrollabel;markMATLABshowtick

To insert XMinorTick marks I am using the following command:
set(gca, 'XMinorTick', 'on');
However, this creates tick marks along both the bottom and top of the axes. I would like the tick marks to appear only along the bottom of the axes.

Best Answer

The ability to hide the XMinorTick marks along the top or bottom of the axes is not available in MATLAB.
To work around this issue, you can use the RECTANGLE function to draw a box to cover the unwanted tick marks. You must manually specify the position of the rectangle to hide the tick marks. Please see the following example which assumes a white axes background color:
% create plot
stem(1:3,1:3);
axis([1 3 0 4]);
set(gca, 'XMinorTick', 'on');
% draw box to cover top ticks
hRect = rectangle('Position',[1.01 3.9 1.98 0.09]);
% change box colors to white
set(hRect,'EdgeColor','white','FaceColor','white');