Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How to select matching records based on the differences in their detection time?

1 Ansicht (letzte 30 Tage)
Marcell Szántó
Marcell Szántó am 28 Dez. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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:
Rajz.png
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.

Antworten (1)

Greg Dionne
Greg Dionne am 25 Feb. 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

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by