Error using vertcat. Dimensions of arrays being concatenated are not consistent.

4 Ansichten (letzte 30 Tage)
Hi I am trying to concatenate 2 tables both of them have the same number of columns but one of the columns, which is called PartyX, varies in length, so in Table1 PartyX is a 1X14 cell array
{'U'} {'XXX'} {'MP'} {'PAFT'} {'100659'} {'101659'} {'MFTP'} {'1000dbd659'} {'dsdad'} {'0'} {'XXX'} {'GB'} {'GB'} {'XXX'}
and in Table2
PartyX is a 1X2 cell array
{'ABC'} {'XXX'}
Could not concatenate the table variable 'PartyX' using VERTCAT.
Caused by:
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
Any suggestions as to how I can resolve this
I am using this to concatenate
Table1 = [struct2table(orderfields(table2struct(Table1)),'asArray',1) ; struct2table(orderfields(table2struct(Table2)),'asArray',1)];

Akzeptierte Antwort

Arthur Roué
Arthur Roué am 5 Aug. 2020
You can merge table with outerjoin function.
Table1 = outerjoin(Table1, Table2, 'MergeKeys',true)

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by