Is it possible to join tables with different variables and sizes by filling/padding the missing variables and rows with NaN or similar?
조회 수: 14 (최근 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
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)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!