Why is 24.0000 not equal to 24.0000 in MATLAB?

Answer

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),:)

All matlab Questions

Ask your interview questions on matlab

Write Your comment or Questions if you want the answers on matlab from matlab Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---