Convert datetime to time of day, to be able to plot along time (e.g. 08:00, 10:00, 12:00 14:00...)

2 ビュー (過去 30 日間)
Vuk
Vuk 2018 年 1 月 2 日
コメント済み: Walter Roberson 2018 年 1 月 4 日
Hello,
I have data in this format:
  • I want to convert the datetime into the time only (in HH:mm) to be able to plot the temperature along the time of the day.
My goal is to produce this graph, but just for one whole day:
  4 件のコメント
KSSV
KSSV 2018 年 1 月 2 日
YOu have to plot w.r.t indices and then label the axes using xtick
Walter Roberson
Walter Roberson 2018 年 1 月 4 日
The ability to use datatime or duration objects for the axes is new in R2016b. Which MATLAB version are you using?

サインインしてコメントする。

回答 (1 件)

Neil Guertin
Neil Guertin 2018 年 1 月 4 日
Use the timeofday function to convert your datetime objects to duration objects. You should be able to use the duration objects on the x axis just as you would use datetime objects. If you are not able to, please post the error message you are seeing.

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by