join two tables using outer or inner join
조회 수: 5 (최근 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에서 Tables에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!