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

115 次查看(过去 30 天)
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?

采纳的回答

Matt J
Matt J 2021-3-9
编辑:Matt J 2021-3-9
isInside = discretize(1.957, [1.410,2.504])==1
isInside = logical
1

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by