Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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.

回答(1 个)

Greg Dionne
Greg Dionne 2019-2-25
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

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by