How can I determine if a value is in the interval?

191 views (last 30 days)
I have an array=[1.410,2.504]
I need to check if the value 1.957 exists within the range of the interval.
How can I do this?

Accepted Answer

Matt J
Matt J on 9 Mar 2021
Edited: Matt J on 9 Mar 2021
isInside = discretize(1.957, [1.410,2.504])==1
isInside = logical
1

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 9 Mar 2021
if and(value>array(1), value<array(end))
display('inside');
else
display('outside')
end

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!