MATLAB Answers

Filter table data into matrix

2 views (last 30 days)
Annymm
Annymm on 1 Oct 2020
Answered: Eric Sofen on 2 Oct 2020
I have rainfall amount data by month for seveeral years and different weather stations. I want to filter the data for May, June July into a new table. How can I do that? My table looks like this:
Date Georgetown Kamarang Lethem Mabaruma NewAmsterdam Timehri
1971-01 120 146.3000 195.6000 227.4000
1971-02 78.9000 82.8000 31.9000 68.8000
1971-03 80.2000 65.1000 15.3000 111.5000
1971-04 126.8000 173.2000 28.1000 178.3000
1971-05 374.6000 271 150.6000 411.3000
1971-06 401.2000 479.1000 505.3000
1971-07 296.6000 320.9000 317 243.5000
1971-08 347.7000 249.1000 227.8000 189.6000 348.4000
1971-09 108.4000 190.9000 104.9000 228.1000 123.1000

Answers (1)

Eric Sofen
Eric Sofen on 2 Oct 2020
From your description, it sounds like you want data for MJJ for all years? Assuming your data is in a timetable and your dates are represented as datetime:
t(ismember(month(t.Date), [5:7]),:)

Community Treasure Hunt

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

Start Hunting!