Uitable data, error using horzcat
조회 수: 2 (최근 30일)
이전 댓글 표시
I am having some trouble with merging and displaying array tables into one uitable in the app designer.
I first have:
rmdData=importdata('AccelQuery.mat')
SERIAL_NUMBER=rmdData.('SERIAL_NUMBER')
BIA_COF_0=rmdData.('BIA_COF_0')
BIA_COF_1=rmdData.('BIA_COF_1')
BIA_COF_2=rmdData.('BIA_COF_2')
BIA_COF_3=rmdData.('BIA_COF_3')
BIA_COF_4=rmdData.('BIA_COF_4')
SF_COF_0=rmdData.('SF_COF_0')
SF_COF_1=rmdData.('SF_COF_1')
SF_COF_2=rmdData.('SF_COF_2')
SF_COF_3=rmdData.('SF_COF_3')
SF_COF_4=rmdData.('SF_COF_4')
This gets the data from the fields within a structure.
I then use the code below to merge the tables and create the uitable:
mergetables=[SERIAL_NUMBER,BIA_COF_0,BIA_COF_1,BIA_COF_2,BIA_COF_3...
,BIA_COF_4,SF_COF_0,SF_COF_1,SF_COF_2,SF_COF_3,SF_COF_4];
mergetable1=array2table(mergetables);
uitdata=uitable(uifigure,'Data',mergetable1);
uitdata.ColumnName={'Accel S/N' ;'BIA_COF_0'; 'BIA_COF_1'; 'BIA_COF_2'; 'BIA_COF_3' ;'BIA_COF_4';...
'SF_COF_0'; 'SF_COF_1'; 'SF_COF_2' ;'SF_COF_3' ;'SF_COF_4'};
I intend the mergetables to have each single array in different columns.
I happen to receive this error for the mergetables:
Error using horzcat
Dimensions of arrays being concatenated are not consistent. Consider converting input arrays to the same type before concatenating.
How should I correct this in order to get the double arrays from the data all merged into one and as well as displaying those values inside the uitable?
댓글 수: 2
Walter Roberson
2020년 7월 13일
mergetable1 = table(SERIAL_NUMBER,BIA_COF_0,BIA_COF_1,BIA_COF_2,BIA_COF_3...
,BIA_COF_4,SF_COF_0,SF_COF_1,SF_COF_2,SF_COF_3,SF_COF_4, 'variablenames', {'Accel S/N' ;'BIA_COF_0'; 'BIA_COF_1'; 'BIA_COF_2'; 'BIA_COF_3' ;'BIA_COF_4';...
'SF_COF_0'; 'SF_COF_1'; 'SF_COF_2' ;'SF_COF_3' ;'SF_COF_4'});
and possibly you would not need to set the ColumnName of the uitable.
Note: table variable with a space or / in the name requires R2019b or later.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!