MATLAB: Add columns and their headers for an existed table in matlab

add new column for a table

Now we have a table T1, I want to add t2,t3(two columns to be added into T1). I have two questions:
1.After using "addvars", the command window says "Undefined function or variable 'addvars'". why this appears and how to fix it? 2.How can I add new headers for t2 and t3 in the new table?

Best Answer

You can add new columns very easily
T1.t2 = yourDataT2; % dimension of yourDataT2 must be sonsistent with the rest of table.
T1.t3 = yourDataT3;
this will add two new columns named t2 and t3 to T1.