Dateticks for hourly data

조회 수: 10 (최근 30일)
Aishwarya
Aishwarya 2012년 4월 19일
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.

답변 (1개)

the cyclist
the cyclist 2012년 4월 20일
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.

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by