# MATLAB: Add data in a table according to the variable names.

tables

I have written a code with a for loop and at the end of each iteration the output is a table with the corresponding variable names, something like this:
      head = {'level_RI1','inflow_RI1','outflow_RI1'}      B.Properties.VariableNames = head;
the second iteration output is a table like this:
      head = {'level_R2','inflow_R2','outflow_R2'}      B.Properties.VariableNames = head;
at the end I want to merge the results of each iteration in a final table which variable names are:
      Result.Properties.VariableNames = {'level_RI1','inflow_RI1','outflow_RI1','level_R2','inflow_R2','outflow_R2'}
But so far I just get the table to overwrite itself at the end of the iterations and the result just contain the final iteration:
      Result.Properties.VariableNames = {'level_R2','inflow_R2','outflow_R2'}
I'd appreciate any help 🙂

result = [T1, T2, T3]
   for i = ...      myTables{i} = ...   end   result = [myTables{:}];