How can I store tables object in an array?

10 vues (au cours des 30 derniers jours)
Ryan Pond
Ryan Pond le 1 Mai 2018
My raw data is a variable number of xy data sets (my current data has 10 sets of xy data). Each data set has a different size but the same type of data. I am performing the same function on each set. Currently I am explicitly creating a table name for each one and then repeating the same operation on each. It would be much easier if I can store all the tables in an array and loop through it.
I enjoy the convenience of referencing the data by column name..

Réponse acceptée

Guillaume
Guillaume le 1 Mai 2018
Option 1 is to store your tables into a cell array. You can then use explicit loops or cellfun to apply the same code to each table.
However, considering that each table have the same columns, the option I would chose would be to concatenate all the tables vertically into one, with an additional column indicating which original table each row came from. varfun or rowfun with the 'GroupingVariables' option using that column would allow to apply functions on each original data set.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by