plot specific time points of everyday in an automated data

1 visualización (últimos 30 días)
Soso
Soso el 9 de Jun. de 2021
Editada: dpb el 9 de Jun. de 2021
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 comentario
dpb
dpb el 9 de Jun. de 2021
Use a timetable and timerange to segment the data over periods of interest...

Iniciar sesión para comentar.

Respuestas (1)

Duncan Po
Duncan Po el 9 de Jun. de 2021
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 comentario
dpb
dpb el 9 de Jun. de 2021
Editada: dpb el 9 de Jun. de 2021
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by