Uitable data, error using horzcat

1 Ansicht (letzte 30 Tage)
Alexandra Philip
Alexandra Philip am 13 Jul. 2020
Kommentiert: Alexandra Philip am 13 Jul. 2020
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 Kommentare
Walter Roberson
Walter Roberson am 13 Jul. 2020
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 am 13 Jul. 2020
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?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by