MATLAB: Is it possible to stack tables

MATLABtables

Hi everyone, I'm facing the following problem: I do several testruns. There are about 10 tests per run, which results in 10 .csv files. I read them with Matlab, do some calculations and store about 6 values per test which I write in a table, thereby creating a 6×10 table. Those values are sometimes strings and sometimes numbers. Then I change the setting and do the next test run, evaluate the files and create the next table. I end up with about 8 tables. Now I would like to somehow stack those tables in order to compare (and plot) the influence of the setting on my test results. I would like to do something like:
all_tables(1, :, 🙂 = table1;
all_tables(2, :, : ) = table2;
etc.
and then read the values back, e.g.
val1 = all_tables(:, 2, 1) ;
Is that possible or is there any other format which is easier to handle than tables?
Thank you in advance 🙂

Best Answer

As far as I can tell, tables are limited to two dimensions. Here are some ideas for storing an arbitrary set of data of arbitrary sizes:
  1. It is possible to concatenate tables (of course this requires that the columns/variables be of the same class). Simply add a new index variable, which tells you which test the data is from.
  2. You could put the tables into a cell array. This might be the easiest solution.
  3. You could avoid the tables entirely, and just use a 3D cell array. This will be difficult if each test produces different length outputs.