From: Kirsten on
Hello all -

I'm trying to limit the number of x-axis labels that appear. I am changing the labels from numbers to date text, but I only want 5 or 6 labels from the 5000+ string to appear at any given time. I can modify the script to allow only 5 or 6 to appear, but the wrong labels are used.

I'm currently using set(gca,'XTick',0:1000:5000,'XTickLabel',x_des)
If the original x-axis labels read 0, 1000, 2000, 3000, 4000, 5000, then when replaced will read 1/1/1900 0:00, 1/1/1900 0:01, 1/1/1900 0:02, etc. instead of the correct labels of 1/1/1900 0:00, 1/3/1900 0:30, etc.

How can I tell MATLAB to look for the corresponding row in the x_des matrix?

Thanks!
From: Ross W on
"Kirsten " <kirsten.swanson(a)swe.org> wrote in message <i4110g$3hj$1(a)fred.mathworks.com>...
> Hello all -
>
> I'm trying to limit the number of x-axis labels that appear. I am changing the labels from numbers to date text, but I only want 5 or 6 labels from the 5000+ string to appear at any given time. I can modify the script to allow only 5 or 6 to appear, but the wrong labels are used.
>
> I'm currently using set(gca,'XTick',0:1000:5000,'XTickLabel',x_des)
> If the original x-axis labels read 0, 1000, 2000, 3000, 4000, 5000, then when replaced will read 1/1/1900 0:00, 1/1/1900 0:01, 1/1/1900 0:02, etc. instead of the correct labels of 1/1/1900 0:00, 1/3/1900 0:30, etc.
>
> How can I tell MATLAB to look for the corresponding row in the x_des matrix?
>
> Thanks!

Hi

You need to tell us the contents of the x_des matrix
How big is it? Is it a cell array or a matrix?

At a wild guess you want something like set(gca,'XTick',0:1000:5000,'XTickLabel',x_des(1:1000:5001,:))

but who knows? you do ...

Ross