Effacer les filtres
Effacer les filtres

Filter timetable by month

15 vues (au cours des 30 derniers jours)
Mark Maders
Mark Maders le 5 Août 2021
Commenté : Mark Maders le 5 Août 2021
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.

Réponse acceptée

Chunru
Chunru le 5 Août 2021
Modifié(e) : Chunru le 5 Août 2021
%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);
  1 commentaire
Mark Maders
Mark Maders le 5 Août 2021
thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by