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

조회 수: 35 (최근 30일)
FW
FW 2019년 5월 29일
답변: Akira Agata 2019년 5월 29일
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.

채택된 답변

Akira Agata
Akira Agata 2019년 5월 29일
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'};

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by