Filter timetable by month

조회 수: 4 (최근 30일)
Mark Maders
Mark Maders 2021년 8월 5일
댓글: Mark Maders 2021년 8월 5일
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.

채택된 답변

Chunru
Chunru 2021년 8월 5일
편집: Chunru 2021년 8월 5일
%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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by