Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
How to select matching records based on the differences in their detection time?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have two arrays containing the detection time of arbitrary events. The two arrays contains different events, but some of the records are the result of the same events. The problem is that the two timestamp has an unknown offset/difference. The thing I need is to select the matching events based on the time difference between the single events. I am sure I did not described it very well, but here is an example:
So here you can see that the events with the green background are the ones I am looking for. Now the problem is that the sum of the difference between the records I am looking for is always changing. Now I know that there are only finite possibilities, but I am not able to write it in a matlab code.
I am sorry I know it is a horrible description of the problem but I cannot really draw up in my mother tounge either.
0 commentaires
Réponses (1)
Greg Dionne
le 25 Fév 2019
I think you want something like this(?):
function [t1s, t2s] = szanto(t1, t2)
% compute time vectors offset from first timestamp.
deltaT1 = t1 - t1(1);
deltaT2 = t2 - t2(1);
% compute points common between both
common = intersect(deltaT1,deltaT2);
% restore offset for t1 and t2
t1s = common + t1(1);
t2s = common + t2(1);
>> [t1s, t2s] = szanto([0 5 8 10 11 12 16 19 20],[13 14 24 25 26 27 29 30 34 36])
t1s =
0 11 12 16
t2s =
13 24 25 29
0 commentaires
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!