Is it possible to join tables with different variables and sizes by filling/padding the missing variables and rows with NaN or similar?

조회 수: 22 (최근 30일)
I have 4 tables that I woulk like to merge/join together into 1 large table. The 4 tables have mostly the same variables, but also a few unique ones for each table. They are also of differing sizes.
Is there a way to join/merge them by padding each table with the missing variables and rows (with NaN or 999 or something like that) so that they are able to be joined?
I've attached a few small subsets of the 4 tables in a .mat file.
  댓글 수: 4

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

답변 (1개)

John Navarro
John Navarro 2020년 6월 10일
편집: John Navarro 2020년 6월 10일
C = outerjoin(A,B,'Keys',{'Common Variable'},'MergeKeys',true)
% Where A and B are the corresponding Tables to merge.
Then you conbine C with the following Table. And so on.
In other words, you take two tables and make one of them. Next, you repeat the process until you became all your Tables in one.
BUT, It wont work if you use the automatic code that is generated by the Task option in the live script.
C = outerjoin(A,B,'Type','left','Keys',{'Country'},'MergeKeys',true)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by