Select rows of timetable based on Month range

4 visualizaciones (últimos 30 días)
Eric Escoto
Eric Escoto el 23 de Sept. de 2021
Comentada: dpb el 25 de Sept. de 2021
Can someone provide the syntax for selecting monthly rowtimes from a timeteble? I would like to select various months. For example, Nov., Dec., Jan., Feb.
Here is what I'm trying:
The 'wintertime' variable and the follwing lines are also screwed up.
Thanks.
% Create new timetables at differing scales.
% Extract the month record
monthofTT = month(TT.Time);
% Determine which records are between November and March (months 1:3 and
% 11:12)
wintertime = [1,3;11,12]; % [start, end] of desired months
wintermonths = monthofTT >= winter(1) & wintertime <= winter(2);
% Isolate all row in winter months
TTwinter = TT(month(TT.Time(winterrmonths)), :);

Respuesta aceptada

dpb
dpb el 23 de Sept. de 2021
Editada: dpb el 24 de Sept. de 2021
To use the numeric months,
wintertime = [1:3 11:12]; % [start, end] of desired months
TTwinter = TT(ismember(month(TT.Time),wintertime), :);
  6 comentarios
Eric Escoto
Eric Escoto el 24 de Sept. de 2021
Ah I see it. Thanks!
dpb
dpb el 25 de Sept. de 2021
Was pretty obvious when not so tired...sorry didn't catch it at first.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by