>> X = sum(bsxfun(@(a,b)abs(a-b)<1e-6,c(:).',c(:)))<2;
>> X(1:find(c==0,1,'last')) = false;
ans = 0.9993
As in my answer to your otherrelated question , note that I did not use equality test== orunique with floating point numbers, but instead compared the difference of two values with some tolerance, in this case1e-6. You can change the tolerance to best suit your problem.