>> n = between(4,[5,0 -7 6], [3, 9, 4, 4])

n =

4

>> n = between(5,[5,0 -7 6], [3, 9, 4, 4])

n =

3

>> n = between(6,[5,0 -7 6], [3, 9, 4, 4])

n =

2

>> n = between(9,[5,0 -7 6], [3, 9, 4, 4])

n =

1

>> n = between(10,[5,0 -7 6], [3, 9, 4, 4])

n =

0

3 views (last 30 days)

Show older comments

zehra ülgen
on 18 Oct 2020

Commented: zehra ülgen
on 19 Oct 2020

Payam Morsali
on 18 Oct 2020

function y=compare(n,A,B)

y=0;

for i=1:length(A)

if n>=A(i) && n<=B(i)

y=y+1;

elseif n>=B(i) && n<=A(i)

y=y+1;

end

end

end

John D'Errico
on 19 Oct 2020

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

Start Hunting!