A=[1 2 3 4 5 6];
B=[0.1 1 1.5 4.5 4 2.5 2 4];
for i=1:max(size(B))
for j=1:max(size(A)-1)
if B(1,i)<=A(1,j)
R(1,i)=A(1,j);
break
else
R(1,i)=A(1,j+1);
end
end
end
It works !!! but is there way to make it very fast I have more than a million elements to compare.
