필터 지우기
필터 지우기

plot specific time points of everyday in an automated data

조회 수: 2 (최근 30일)
Soso
Soso 2021년 6월 9일
편집: dpb 2021년 6월 9일
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
dpb
dpb 2021년 6월 9일
Use a timetable and timerange to segment the data over periods of interest...

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

답변 (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에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by