How to add labels to an array or table (after conversion from an array)

37 views (last 30 days)
I have an array of 2000 x 4 data points. I would like to add labels to the columns only. For example, Column 1 should be 'time/min', column 2 "FT_cor 15uL'", column 3 is 'time/min', and column 4 is "FT_cor 20uL'". I was trying to use array2table option but it apparently needs row labels as well. This was my syntax
CombinedArray=[Dataset_15uL, Dataset_20uL]; which is, say, 2000x4
colname= {'time/min'; 'FT_cor 15uL';'time/min'; 'FT_cor 20uL'};
Comb=array2table(CombinedArray,'VariableNames',colname);
The above syntax does not work (This is MATLAB 2017b). Thanks.

Accepted Answer

Akira Agata
Akira Agata on 29 May 2019
This is because some characters (such as '/' ) and white space ' ' are not allowed to use as variable names in table. Also, each variable name in one table should be unique. So, please revise the colname before making table Comb, like:
colname = {'time_min','FT_cor15uL','time_min2','FT_cor20uL'};

More Answers (0)

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!