I have the following code that filters a timetable to show only rows in January
T_Departures_Jan = T_Departures.Date_Time(timerange('01/01/2020', 'months'),:);
T_Departures_Jan = T_Departures(T_Departures_Jan,:);
Jan_KWH = sum(T_Departures_Jan.AircraftKWH);
Is there a way to do this without giving a solid start date? I don't want this to be 2020 exclusive - I wish to be able to apply the code to previous/future year sets of input data.

 Respuesta aceptada

Chunru
Chunru el 5 de Ag. de 2021
Editada: Chunru el 5 de Ag. de 2021

0 votos

%T_Departures_Jan = T_Departures.Date_Time(timerange('01/01/2020', 'months'),:);
T_Departures_Jan = T_Departures(month(T_Departures.Date_Time) == 1,:);
Jan_KWH = sum(T_Departures_Jan.AircraftKWH);

Más respuestas (0)

Categorías

Más información sobre Interpolation en Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Etiquetas

Preguntada:

el 5 de Ag. de 2021

Comentada:

el 5 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by