plot specific time points of everyday in an automated data

2 次查看(过去 30 天)
Hi there
I am working with autmated weight data recorded every 15 minutes ove 14 months. I really need help to plot specific time points for every single day for example I need to plot weight data for every day between 4-6am over the 14 month.
Your help will be highly appreciated

回答(1 个)

Duncan Po
Duncan Po 2021-6-9
See this example of checking the hour component of a datetime, and then using logical indexing to extract a time range:
dt = datetime(2021,1,1):minutes(15):datetime(2021,1,4); % construct a datetime every 15 minutes for 3 days
h = hour(dt);
dt1 = dt(h >= 4 & h < 6); % extract only between 4am and 6am
dt1(1:5)
ans =
1×5 datetime array
01-Jan-2021 04:00:00 01-Jan-2021 04:15:00 01-Jan-2021 04:30:00 01-Jan-2021 04:45:00 01-Jan-2021 05:00:00
  1 个评论
dpb
dpb 2021-6-9
编辑:dpb 2021-6-9
Indeed, timerange() does NOT have sufficient intelligence built into it to be able to isolate a time-of-day section; it is a brute-force-only club, it seems.
I think this is a big oversight in functionality; one should NOT have to build secondary grouping/selection variables manually for such tasks.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Time Series Events 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by