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.
Join tables on closest dates
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!