Uitable data, error using horzcat

1 次查看(过去 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
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 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by