joining two timetables to complete the timeseries

2 views (last 30 days)
Muhammad Haris Siddiqui
Muhammad Haris Siddiqui on 20 Nov 2021
Answered: Peter Perkins on 23 Nov 2021
I have two timetables Allyears1 and TS. Allyears1 contains the whole time series with nans and TS contains the missing values of Allyears1.
I want to join these timetable complete the time series
I have tried as shown below but it is not joing the timetables rather just showing in a timetable.
Any help would be appreciated
Thanks

Answers (2)

KSSV
KSSV on 20 Nov 2021
You can fill the NaN values using fillmissing. Read about it.
  3 Comments
Muhammad Haris Siddiqui
Muhammad Haris Siddiqui on 21 Nov 2021
I used outer join, inner join, left join, Synchronize, merge all are just showing all the columns in a single timetable as shown in my question.
out of compulsion, I used for loop to join the table.
anyways thank you the comments.

Sign in to comment.


Peter Perkins
Peter Perkins on 23 Nov 2021
Muhammad, join is sort of like a horizontal concatenation operation. That is not, I think, what you are looking for. You say
I have two timetables Allyears1 and TS. Allyears1 contains the whole time series with nans and TS contains the missing values of Allyears1.
but it's not clear what you mean by that. You might mean (1) that TS.Allyears1 contains rowtimes that are not contained in Allyears1, but the union of the two disjoint sets is your complete time series. You might mean (2) that TS.Allyears has rowtimes thjat are also in Alyears1, and in the latter the datavalues are missing inn those rows. Those are very different things.
In any case, you don't want a horz cat, and all those things you tried are essentially that. But there's no reason to use a loop. Use vertcat for (1), then sortrows. Use assignment for (2), something like
Allyears.VarName35(TS.Allyears.Date) = TS.Allyears.TS
But this is all just guesswork. Provide more details.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!