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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/199853/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.
0 个评论
回答(1 个)
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
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!