MATLAB: How to use <, > operator as I intended

operator

** Matlab results**
>> y1 = [1 2 3 4 5]
y1 =
1 2 3 4 5
>> y2 = 0<y1<3
y2 =
1 1 1 1 1
In this case, why array y2's value is not [ 1 1 0 0 0 ]?

Best Answer

(y1>0) & (y1<3)
Related Question