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)
