MATLAB: Using XTick

xtick

Apologies for the rudimentary question, I'm very much a novice with Matlab. I am trying to set the x axis tick marks for a figure using XTick and it's not working. Can anyone tell me what I am missing here? The code is this:
figure
plot(damp1,'+r')
hold on
plot(damp2,'+r')
plot(lamp1,'ob')
plot(lamp2,'ob')
plot(mean,'xk' )
XTick = [0:1:6]
xlabel('Sample')
ylabel('Depth(m)')
legend('daily amplitude +','daily amplitude -','lunar amplitude +','lunar amplitude -','mean depth')
hold off

Best Answer

Hi Jenny, use set(gca,'xtick')
plot(randn(17,1));
XTick = [0:16];
set(gca,'xtick',XTick)