how to test if a number belongs to a range of numbers.

 Accepted Answer

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

More Answers (0)

Categories

Find more on Just for fun in Help Center and File Exchange

Asked:

on 25 May 2015

Commented:

on 25 May 2015

Community Treasure Hunt

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

Start Hunting!