Hi there,
I have the following datasets:
a = 5 7 8 9 10 12b = 3 6 11 13 20 22
I want to look if each element of a is in any of the intervals in b, without a for-loop. The for loop is:
result = zeros(length(a),1);for i =1:length(a) for j= 1:size(b,1) if a(i)>=b(j,1) && a(i)<= b(j,2) result(i) = 1 break; end endend
I am hoping to speed this up.
Best Answer