Abel
Posts:
31
Registered:
5/29/13


Re: Vectorial inclusions inter
Posted:
Jun 28, 2013 5:57 AM


And moreover I managed to do it like this :
function Z=original_event(X,Y)
Z=zeros(size(X,1),4);
for i = 1 : size(X,1) for j = 1 : size(Y,1) if X(i,1)>= Y(j,1) && X(i,2) <= Y(j,2) Z(i,1:2)=X(i,:); Z(i,3:4)=Y(j,:); end end
It works but it is not fast. The problem is X and Y must contain thousands of datas. So I would like to avoid the for loops. I asked someone to give a try to the solution with bsxfun and it works with its Matlab versions but, according to him, it is slower than my original_event function. So I don't know what to do but I would like to know if there a possiblity to avoid any loops, or to combine them in some ways.

