join two tables using outer or inner join

7 Ansichten (letzte 30 Tage)
Ketan Bharucha
Ketan Bharucha am 13 Sep. 2017
Beantwortet: Guillaume am 13 Sep. 2017
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

Akzeptierte Antwort

Guillaume
Guillaume am 13 Sep. 2017
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.

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by