join two tables using outer or inner join
2 次查看(过去 30 天)
显示 更早的评论
I have two tables:
table one:;
Time addr A B tgt_lat tgt_lon
'13-Sep-2017 00:55:19' '70C0CE' 0 2 23.2990691252053 60.4228210262954
'13-Sep-2017 00:55:19' '778822' 0 2 29.4469298981130 48.7358269840479
'13-Sep-2017 00:55:19' '30061F' 0 2 29.1113022342324 39.1538731567562
table two:
Time addr lat lon TimeA
'13-Sep-2017 00:55:23' '70C0CE' 23.2949725538492 60.4417419992387 '00:55:22.315'
'13-Sep-2017 00:55:25' '70C0CE' 23.2933432795107 60.4494731314480 '00:55:25.565'
'13-Sep-2017 00:55:32' '70C0CE' 23.2896656356752 60.4664612375200 '00:55:32.575'
'13-Sep-2017 00:55:36' '70C0CE' 23.2881294004619 60.4737345501781 '00:55:35.545'
'13-Sep-2017 00:55:37' '70C0CE' 23.2871245779097 60.4782881028950 '00:55:37.445'
how can I join these two table based on the matching latitude and longitude? (matching 'tgt_lat' with 'tat' and 'tgt_lon with 'lon')
thank you
0 个评论
采纳的回答
Guillaume
2017-9-13
I'm unclear what difficulty you have. You seem to have already worked out which function you need.
join(table1, table2, 'LeftKeys', {'tgt_lat', 'tgt_lon'}, 'RightKeys', {'lat', 'lon'})
Replace join by innerjoin or outerjoin depending on which result you want.
Note that the above requires that keys are exactly equal, so you may want to round them to only a few decimals.
0 个评论
更多回答(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!