Remove overlapping intervals from two array intervals without using a loop

조회 수: 6 (최근 30일)
Alba Solb
Alba Solb 2018년 2월 7일
댓글: Bruno Luong 2021년 1월 24일
Having the start and end of each interval of the noise array, how could I do it to exclude those times that overlap with another interval array of detections?
I know how to do it in a loop, but then it has to go interval by interval to check if they overlap to excluded it and this takes to much time. Is there a better approach that I could use without using a loop?
I know I can check for the overlapping intervals like this:
ovlp = @(x, y)bsxfun(@ge, x(:, 1), y(:, 1)') & bsxfun(@le, x(:, 1), y(:, 2)');
idx = ovlp(noise,det) | ovlp(det, noise)';
[row, col] = ind2sub(size(idx), find(idx));
output = [row, col];
However, then this does not tell me what start or end of the noise interval will become the end of the detection interval.
Thank you so much for your help.
Alba

답변 (2개)

Asrar Khaldey
Asrar Khaldey 2021년 1월 24일
Hi
Unfortunately I have the same problem.. can u please share the solution if u found one

Bruno Luong
Bruno Luong 2021년 1월 24일
You might interest to use my interval-merging FEX

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by