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!