Splitting a Table at Every N Rows
채택된 답변
추가 답변 (1개)
2 개 추천
댓글 수: 3
Even in earlier versions, I would recommend not splitting the table into smaller tables.
tables have functions that let you perform calculations by group, e.g. by country. For example, to calculate the mean of some columns per country, you'd do:
varfun(@mean, yourtable, 'GroupingVariables', 'Country', 'InputVariable', {list_of_variables_to_average})
In general, it is better to keep data together in the same variable and use indexing or filtering to get what you want rather than splitting it into multiple variables.
"The problem is that varfun can only plot all the 75 countries data together"
varfun can do anything you want. The function you pass to varfun can be as complex as you wish.
"only a certain grouping of those countries (like say, only the EU or only OECD countries)"
Add a column to your table for these categories, if it does not exist already. You can then use the 'GroupingVariables' option of varfun.
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!.png)
