The problem you're having relates to floating point comparison. The numbers differ by very small decimal amounts. You would have to do the comparisons by checking that the values are within some range of one another. For example: a = 24; b = 24.000001; tolerance = 0.001; if abs(a-b) < tolerance, disp('Equal!'); end will display "Equal!". You could then change your code to something like: points = points((abs(points(:,1)-vertex1(1)) > tolerance) | ... (abs(points(:,2)-vertex1(2)) > tolerance),:)