How to select multilple months in a time series.
조회 수: 4 (최근 30일)
이전 댓글 표시
f = readtable('Sample data.xlsx')
Kindly help me with code to select January, February, March, April, November and December data as dry season months in a different sheet. Select the remaining months data as wet season in another sheet. Thanks.
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 1월 6일
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/855600/Sample%20data.xlsx';
f = readtable(filename);
[~, m, ~] = ymd(f.Time);
mask = ismember(m, [1:4 11:12]);
dry = f(mask,:);
wet = f(~mask,:);
dry(1:5,:)
wet(1:5,:)
댓글 수: 2
Walter Roberson
2022년 1월 6일
In my experience, people are more likely to want to group by season -- one dry season, one wet season, one dry season, and so on -- instead of wanting to bunch together all wet in one place, and all dry in another.
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!