Hi, I am trying to use an if statement using the == comparator to search an array of numbers. Something like this:
for i = 1:100 if a == array(i,1) % do stuff here
endend
Doing this, however, leads to the if statement never being true. When I would expect a and the array value to be equal, the statement is still false, due to a very minute difference of something around the order of 10^-8.
What is causing this very small error and what are some of the workarounds you guys suggest? Alternatively, is there a smarter way to search an array of numbers?
Best Answer