MATLAB: How to include the labels 1, 2, 3, …, 10 in a log-log plot in MATLAB 7.14 (R2012a)

MATLAB

When I make a loglog plot using the following code:
loglog([1:10], [1:10].^2)
I would like to label the tick marks on the x-axis as 1, 2, 3,…, 10. However, when I change the tick labels by setting the 'XTickLabel' property, the plot doesn't have all the labels I would like. How can I include all the tick marks 1, 2, 3, …, 10?

Best Answer

You can set the 'XTick' property as follows:
loglog([1:10],[1:10].^2)
set(gca, 'XTick', [1:10])
This will produce labelled tick marks including 1, 2, 3, ..., 10, spaced logarithmically.