Failure on combining 2 timetable

2 ビュー (過去 30 日間)
DY
DY 2023 年 8 月 21 日
編集済み: Star Strider 2023 年 8 月 21 日
When I combine 2 timetables horizontally, error always occurs. How can I manage to combine them?
The 2 timetables (a and b) have the same time rows but different variable arrays:
a =
5×1 timetable
Time ID1S01_PWM_timerticks_ph1
__________ _________________________
4.2981 sec 0
4.303 sec 65534
4.3081 sec 0
4.3131 sec 0
4.3181 sec 0
b =
5×1 timetable
Time ssiSelSicMsg2
__________ _____________
4.2981 sec 9
4.303 sec 9
4.3081 sec 9
4.3131 sec 9
4.3181 sec 9
>> [a b]
Error using tabular/horzcat
All tables being horizontally concatenated must have the same row times.

採用された回答

Star Strider
Star Strider 2023 年 8 月 21 日
編集済み: Star Strider 2023 年 8 月 21 日
Experiment with the synchronize function to see if it will do what you want.
EDIT — (21 Aug 2023 at 15:57)
To illustrate —
Time = [4.2981; 4.3030; 4.3081; 4.3131; 4.3181];
ID1S01_PWM_timerticks_ph1 = [0; 65534; 0; 0; 0];
T1 = timetable(seconds(Time),ID1S01_PWM_timerticks_ph1)
T1 = 5×1 timetable
Time ID1S01_PWM_timerticks_ph1 __________ _________________________ 4.2981 sec 0 4.303 sec 65534 4.3081 sec 0 4.3131 sec 0 4.3181 sec 0
ssiSelSicMsg2 = 9*ones(5,1);
T2 = timetable(seconds(Time), ssiSelSicMsg2)
T2 = 5×1 timetable
Time ssiSelSicMsg2 __________ _____________ 4.2981 sec 9 4.303 sec 9 4.3081 sec 9 4.3131 sec 9 4.3181 sec 9
Tsync = synchronize(T1,T2)
Tsync = 5×2 timetable
Time ID1S01_PWM_timerticks_ph1 ssiSelSicMsg2 __________ _________________________ _____________ 4.2981 sec 0 9 4.303 sec 65534 9 4.3081 sec 0 9 4.3131 sec 0 9 4.3181 sec 0 9
EDIT — (21 Aug 2023 at 20:23)
Changed to use original variable names. Code otherwise unchanged.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeArray Geometries and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by