Extracting data based on categories
이전 댓글 표시
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?
z=['01-Jan-1973' 0.0114583333333333
'01-Jan-1974' 0.0918518518518519
'01-Jan-1975' 0.0529032258064516
'01-Jan-1976' 0.213571428571429
'01-Jan-1977' 0.0857692307692308]
E=[0 1 0 2 1]
I would like to create three new tables in the same format as z, like below.
A=['01-Jan-1973' 0.0114583333333333
'01-Jan-1975' 0.0529032258064516]
B=['01-Jan-1974' 0.0918518518518519
'01-Jan-1977' 0.0857692307692308]
C=['01-Jan-1976' 0.213571428571429]
My actual tables and vectors are 1x79, making extracting the three new tables challenging to do by hand.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!