Uitable data, error using horzcat

조회 수: 2 (최근 30일)
Alexandra Philip
Alexandra Philip 2020년 7월 13일
댓글: Alexandra Philip 2020년 7월 13일
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
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.
Alexandra Philip
Alexandra Philip 2020년 7월 13일
Yes, I have the R2020a version. I need the uitable to display the table data in a figure. After I inputted the code I got this display:
I need the values from the table to be within the uitable figure.
Any suggestions?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by