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

1 回表示 (過去 30 日間)
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)];

採用された回答

Arthur Roué
Arthur Roué 2020 年 8 月 5 日
You can merge table with outerjoin function.
Table1 = outerjoin(Table1, Table2, 'MergeKeys',true)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by