Plotting data throughout a 24 hour period

조회 수: 7 (최근 30일)
Rory
Rory 2013년 9월 18일
Hello,
I have data for a single 24 hour period. The data consists of time stamped sensor readings throughout the day.
The original data was time stamped using the 'DateNumber' format. I have converted the time into the 'datevec' format. The time is now in a 6 column matrix where columns 4:6 represent the hour, minute and seconds respectively.
I have plotted the data using a scatter plot where the sensor readings have been plotted against the fourth column only i.e. only for the hour and disregarding the minutes & seconds.
Could somebody explain how to include the minutes as well as the hour within the plot?
Thanks
Rory

채택된 답변

Björn
Björn 2013년 9월 18일
I would suggest the following:
hour = datevec(:,4);
minute = datevec(:,5);
hour_decimal = hour+minute/60;
plot(hour_decimal,data)
Does this what you want it to do?
  댓글 수: 1
Rory
Rory 2013년 9월 18일
Excellent, exactly what I wanted. Thankyou Bjorn!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

the cyclist
the cyclist 2013년 9월 18일
An alternative is to plot against the original datenum format, and then use the datetick command to annotate the x-axis labels.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by