필터 지우기
필터 지우기

Combine Timetable's

조회 수: 24 (최근 30일)
Ioannis Tsikriteas
Ioannis Tsikriteas 2018년 9월 8일
댓글: Ioannis Tsikriteas 2018년 9월 22일
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
Peter Perkins 2018년 9월 12일
Perhaps
tt12 = [tt1; tt2]
i.e., just like any other MATLAB array.
  댓글 수: 3
Steven Lord
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
Ioannis Tsikriteas 2018년 9월 22일
Thanks a lot!!! The second method was the answer to my problem!!!

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by