필터 지우기
필터 지우기

Select rows of timetable based on Month range

조회 수: 4 (최근 30일)
Eric Escoto
Eric Escoto 2021년 9월 23일
댓글: dpb 2021년 9월 25일
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)), :);

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by