how to find a float number
2 views (last 30 days)
I have a data (saved as double), as in the attache file. I need to find for example if a certain float number (for ex. -0.334) exist or no.
but because the nubers actully exist as -0.3440099999999 or sth like that, I can't find.
I have tried to change the format, but it did'nt solve the problem.
More Answers (1)
Walter Roberson on 20 Sep 2021
[is_there, idx] = ismembertol(-0.3340, y7) %options allow you to control tolerances
[~, idx] = min(abs(y7(:) - (-0.3340)));
will show you the y7 that is closest to -0.3340, even if it is not very close. Whereas the ismembertol() will only return results if the value is within tolerance