joining two timetables to complete the timeseries
1 view (last 30 days)
Show older comments
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/807384/image.png)
Any help would be appreciated
Thanks
0 Comments
Answers (2)
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.
0 Comments
See Also
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!