MATLAB: How to change the x ticket lables in a plot

axisdataMATLABmonthplotplottingticketstimexlable

Hi, I have : x=1:12 %the index of months
y=x.^2;
plot(x,y)
No I want to change the position of x labels from below the tickets to the middle of interval (between every 2 tickets). Can you please help me?

Best Answer

x=1:12 %the index of months
y=x.^2;
plot(x,y)
set(gca,'xtick',[ 1 3 5 7 9 11]) % use whatever you want