Dateticks for hourly data

9 ビュー (過去 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 Center および File ExchangeGrid 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