Synchronize timetables stored in a structure

I have a structure S with N fields F_1 to F_N. Each field stores a timetable T_1 to T_N, respectively. How do I synchronize the timetables and keep them in the same structure?

4 commentaires

Synchronize them with respect to what? And are you looking for 'union', 'intersection', or a specified list of times? Are you looking for keepOriginalTimes ?
I would like to ynchronize them with respect to the first timetable T_1 and keep the time vector of T_1. I assume I'll have to use InterpMethod since in my case all other timetables do not exceed the size of T_1 but can be shorter and are within the time range of T_1.
The Matlab instructions on KeepOriginalTimes are not very helpful. Not clear what the "Original Time Vector" is. Original with respect to what? Which Time Vetor?
I am not currently convince that you want to synchronize().
I suspect that what you want to do is to retime() all of them to the same timestamps (the ones available for T_1)
Thank you very much for your attention. Initially, all timetables may only have either a) the same exact number of timestamps of T_1 or b) a smaller number of timestamps than T_1. All timetables have the same timestamp increment (1 minute). In either case a) or b), all timetables have timestamps in between or equal to the first and the last timestamp of T_1. The objective of the synchronization or the retiming (we'll figure out which one I need) is to end up with all timetables in the structure having the same number of timestamps of T_1 and between the first and the last timestamp of T_1. The data corresponding to the missing timestamps, if any, would have to be filled through linear interpolation. I do realize my first question was ambigous. Thank you.

Connectez-vous pour commenter.

 Réponse acceptée

One possible interpretation of your question:
Sc = struct2cell(S);
joint = sortrows(vertcat(Sc{:}));
synchronized = structfun(@(F) synchronize(F, joint, 'union'), S, 'uniform', 0);
This (tries to) synchronize each of the timetables against all of the other ones, by combining all of them together into one and synchronizing against that.

2 commentaires

NT1 = S.T_1.Properties.RowTimes;
Retimed = structfun(@(F) retime(F, NT1, 'linear', 'EndValues', 'linear'), S, 'uniform', 0);
Thank you. It works if I replace the 'linear' EndValues with 'extrap'.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Produits

Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by