MATLAB: Table variable name based on array

tables

Hi, is it possible to assign table variable name based on strings in an array. For example:
colnames={'a' 'b'};
a=[1;2];
b=[3;4];
c=table();
c.colnames{1}=a;
c.colnames{2}=b;
Thank you.

Best Answer

Do you mean like this:
c.(colnames{1}) = a;
c.(colnames{2}) = b;