Given a set number of ranges:
a =
32225 52259
52260 70794
70795 91459
91460 95409
And a single value x = 61450
- is there a way to determine within which range x falls without using a loop to check each possibility? The answer in this case would be 2
as 61450 falls within the second range.
use
res = find(x >= a(1,:) & x < a(2,:));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With