matlab x axis label set as a vector
How can I set the x axis label as a vector? For example, if I do plot(1:5), the x axis label is [1, 2, 3, 4, 5]. I'd like to set it to a vector, e.g. [1 4 5 7 10]. Note that the vector's size may be huge, so doing开发者_StackOverflow it manually is not acceptable.
I believe this is what you want.
y = 1:5;
x = [1 4 5 7 10];
plot(y);
set(gca,'XTickLabel',x);
you can do this by sending plot
two vectors: one for x and one for y.
plot([1 4 5 7 10], 1:5);
精彩评论