MATLAB: How to get average/max/min table of many tables

dataMATLABtable

Hi,
I have a .mat file including many tables with the same size/ thing: var names are the same, row names are the same, but the values in each cell are different (because they are for different scenarios). So is there a way to get a new table with the average cell values for all the tables? And MaxTable, MinTable which has the max/min values in each cell?
Thank you.

Best Answer

Have you tried the mean() and max() functions to see if they work with a table. I haven't though they probably won't since tables can contain non-numeric data.
The other option is to just extract each column into an array, and then you can use whatever function you want. Like for 3 tables:
col11 = table1{:, 1};
col21 = table2{:, 1};
col31 = table3{:, 1};
meanCol = mean([col11, col21, col31]);
maxCol = max([col11, col21, col31]);
If you have a lot of them, you can put them into a loop where you read each table from a file, and extract each column one at a time into a 2-D array and then do the math. See The FAQ
Attach your data in .mat files with the paper clip icon if you need more help.