Since the bug has been fixed on 30 May 2012 , I use range_intersection . It works like a charm and is definetely faster than other FEx MergeBrackets.m (Interval merging by Bruno Luong)
One more test could be added:
x1 = [0 10 16 20 ]
x2 = [ 3 5 15 19 25]
-> out = 3 5 16 19
now if x1 has one more value :
x1 = [0 10 16 20 26]
you get :
Attempted to access first(2); index out of bounds because numel(first)=1.
Error in range_intersection (line 35)
if first(2)<second(1)
The test would be to check that the input vector are divisible by 2 ?
Comment only
15 Jun 2012
Range intersection
Mathematical intersection of range composed of a union of intervals
Since the bug has been fixed on 30 May 2012 , I use range_intersection . It works like a charm and is definetely faster than other FEx MergeBrackets.m (Interval merging by Bruno Luong)
Comment only