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

44 vues (au cours des 30 derniers jours)
FW
FW le 29 Mai 2019
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.

Réponse acceptée

Akira Agata
Akira Agata le 29 Mai 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'};

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by