Timeable Table/ Synchronize Problem

조회 수: 2 (최근 30일)
jcclar12
jcclar12 2022년 11월 3일
답변: Santosh Fatale 2022년 11월 10일
Hello again,
I am looking to synchronize two tables. I was able to create a timetable for one table using sample rate time looking like this (first column is time, second column is variable, this time starts at 0):
A =
1.2 555
1.21 543
1.22 875
1.23 212
The second table I want to convert to a timeable table but looks completely different. Like this(first column is time, second is variable, this time starts at 231.1):
B=
234.1 10
234.7 70
400.4 30
600.5 10
I want to combine both tables to one table, however I want 'B' to show the time in the appropriate place in a similar format as A.
Ideally I would want it to look like this:
A+B=
234.1 344 10
234.2 0 0
234.3 0 0
234.4 0 0
234.5 0 0
234.6 0 0
234.7 76 70
Hopefully you get the idea. How would I do that in Matlab? I know Rstudio has a function called 'rbind' that might be able to do this.
The code I have for 'B' is
table2timetable(B,'SampleRate',100)
Thank you.
  댓글 수: 1
jcclar12
jcclar12 2022년 11월 3일
In addition.
'A' has 500 rows
'B' has 70 rows
Not sure if that makes a difference

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

채택된 답변

Santosh Fatale
Santosh Fatale 2022년 11월 10일
Hi Jeska,
I believe you are able to convert table variable "A" into timetable format. For table variable "B", you can use "table2timetable" function with option 'RowTimes' and can use first column of table variable "B" as timeVarName.
To synchronize these two timetable variables, you can either use
newTT = [ttA; ttB]; % Vertical concatenation
newTT = [ttA ttB] % Horizontal concatenation
or use "synchronize" function to synchronize two timetable variables.
For more information, check out these links.

추가 답변 (0개)

카테고리

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