Join tables on closest dates

3 ビュー (過去 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 Center および File ExchangeLanguage Fundamentals についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by