How can I store tables object in an array?
15 views (last 30 days)
Show older comments
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..
0 Comments
Accepted Answer
Guillaume
on 1 May 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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!