Join tables on closest dates

조회 수: 5 (최근 30일)
Frederick Awuah-Gyasi
Frederick Awuah-Gyasi 2022년 11월 3일
답변: Steven Lord 2022년 11월 3일
CB = {
1.1 2.4 '16-Dec-2021 14:36:02'
1.1 2.5 '16-Dec-2021 14:46:17'
1.2 2.6 '16-Dec-2021 14:56:32'
1.3 4.6 '16-Dec-2021 15:06:47'
3.4 4.5 '16-Jan-2021 15:17:02'
2.3 1.2 '16-Jan-2021 15:27:17'
1.1 2.4 '16-Jan-2021 14:36:02'
1.1 2.5 '16-Jan-2021 14:46:17'
1.2 2.6 '16-Jan-2021 14:56:32'
1.3 4.6 '16-Feb-2021 15:06:47'
3.4 4.5 '16-Feb-2021 15:17:02'
2.3 1.2 '16-Feb-2021 15:27:17'
};
CA = {
'A' 2 '2021.12.16.14.30.23'
'B' 4 '2021.01.16.14.28.23'
'C' 0 '2021.02.16.14.30.23'
};
T1 = cell2table(CA, 'VariableNames',{'X','Y','DateTime'})
T2 = cell2table(CB, 'VariableNames',{'A','B','Datetime'})
The goal is have a join(T1,T2,'DateTime',1, Datetime,2) using the nearest date so this should result in just a 3 rowed tabled. Any help.

답변 (1개)

Steven Lord
Steven Lord 2022년 11월 3일
I'd probably try converting those table arrays to timetable arrays using table2timetable and then using synchronize to synchronize them to a common time basis.

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by