Add timetable with many months to another timetable with few months

조회 수: 1 (최근 30일)
Martin
Martin 2019년 9월 13일
댓글: Martin 2019년 9월 13일
I have two time tables like this:
cars =
1×1 timetable
Time Cars
________ ________
Sep-2019 42
and
bus =
1×1 timetable
Time buses
________ _______
Aug-2019 12
Sep-2019 54
Then I need to add the bottom table to the top table like this:
cars =
1×2 timetable
Time Cars buses
________ ________ _______
Sep-2019 42 54
Anyone have an idea for this?

채택된 답변

Sean de Wolski
Sean de Wolski 2019년 9월 13일
Look at synchronize it does exactly this:
tt = timetable(dateshift(datetime,'start','day'), 42, 'VariableNames',"Cars")
tt2 = timetable([dateshift(datetime,'start','day');datetime], [42;17], 'VariableNames',"Buses")
synchronize(tt,tt2,"intersection")
And if you want to play with this kind of thing interactively, in 19b, which shipped yesterday, you can use the join tables "Live Task".
2019-09-13_16-50-26.png
  댓글 수: 2
Adam Danz
Adam Danz 2019년 9월 13일
+1
I keep forgetting about synchronize! I guess I need a project that uses timetables.

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

추가 답변 (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