Splitting a Table at Every N Rows
Risposta accettata
Più risposte (1)
2 voti
3 Commenti
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.
Categorie
Scopri di più su Tables in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!.png)
