Combine Timetable's
古いコメントを表示
Hi, i want to combine two timetables (9 column's) based the time.
The timetables has the same type of measurements with different time and i want to combine them into 1 timetable but when i use the 'synchronize' function i get a timetable with 18 columns!
I just want the second matrix (the one with the dates after the first one) to be added below of the dates of the first Timetable
回答 (1 件)
Peter Perkins
2018 年 9 月 12 日
Perhaps
tt12 = [tt1; tt2]
i.e., just like any other MATLAB array.
3 件のコメント
Ioannis Tsikriteas
2018 年 9 月 17 日
Steven Lord
2018 年 9 月 17 日
Concatenation with [] is defined for timetable arrays just like it's defined for many other data types in MATLAB. Let's define two datetime arrays:
>> dt1 = datetime('today')+(-1:1).';
>> dt2 = dt1 + 3;
and two timetable arrays:
>> tt1 = timetable(dt1, [1; 3; 6], [10; 15; 21]);
>> tt2 = timetable(dt2, [1; 4; 9], [16; 25; 36]);
If we combine the two timetable arrays using synchronize, you receive a timetable with six rows and four variables.
>> tt3a = synchronize(tt1, tt2)
tt3a =
6×4 timetable
dt1 Var1_tt1 Var2_tt1 Var1_tt2 Var2_tt2
____________________ ________ ________ ________ ________
16-Sep-2018 00:00:00 1 10 NaN NaN
17-Sep-2018 00:00:00 3 15 NaN NaN
18-Sep-2018 00:00:00 6 21 NaN NaN
19-Sep-2018 00:00:00 NaN NaN 1 16
20-Sep-2018 00:00:00 NaN NaN 4 25
21-Sep-2018 00:00:00 NaN NaN 9 36
If we combine the two timetable arrays using concatenation, we receive a timetable array with six rows but only two variables.
>> tt3b = [tt1; tt2]
tt3b =
6×2 timetable
dt1 Var1 Var2
____________________ ____ ____
16-Sep-2018 00:00:00 1 10
17-Sep-2018 00:00:00 3 15
18-Sep-2018 00:00:00 6 21
19-Sep-2018 00:00:00 1 16
20-Sep-2018 00:00:00 4 25
21-Sep-2018 00:00:00 9 36
Ioannis Tsikriteas
2018 年 9 月 22 日
カテゴリ
ヘルプ センター および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!