how to test if a number belongs to a range of numbers.
4 views (last 30 days)
Show older comments
I'm trying to set up an equation where if I have a vector x=[1 b], if b>2 I get back y=true? Any advice? Thanks!
Accepted Answer
Stephen23
on 25 May 2015
You just need to check each part separately:
>> fun = @(x) x(1)==1 && x(2)>2;
>> fun([1,5])
ans =
1
>> fun([1,1])
ans =
0
0 Comments
More Answers (0)
See Also
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!