I have a table (z) with two columns, year and annual precipitation. I have a separate vector (E) of three categories (0,1,2) that correspond to the years in the first table. The categories are unevenly spaced. I would like to create three new tables of year and annual precipitation, one for each category. How do I extract the correct year and precipitation data for each category and populate new tables?
E=[0 1 0 2 1]
I would like to create three new tables in the same format as z, like below.
My actual tables and vectors are 1x79, making extracting the three new tables challenging to do by hand.