Dateticks for hourly data

10 views (last 30 days)
Aishwarya
Aishwarya on 19 Apr 2012
Hi,
I have hourly data for ten days. I have 235 values of a variable. I'm trying to plot it in 'dd/HH' format for x axis. Here is the sample code I wrote. But it gives me plenty of zeros in x axis which are not uncomprehensible.
% datetick example
clear all
clc
startdate=datenum('07-01-2011 00:00:00')
enddate=datenum('07-10-2011 18:00:00')
xdata=linspace(startdate,enddate,235);
val=1:235;
plot(xdata,val)
set(gca,'XTick',xdata);
datetick('x','dd/HH','keepticks')
Thanks in advance,
Aishwarya.

Answers (1)

the cyclist
the cyclist on 20 Apr 2012
You are setting the tick marks to be at every single value of your xdata. 235 ticks marks! Then you are specifically telling the datetick command to keep those ticks. I suggest you change one of those two commands.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!