MATLAB: Need Conditional ElseIf statement

conditional statementselseifif

w=[200 205 188;169 255 156;192 168 172]
if(0<w(5)<255)
x=1;
else
x=2;
end
for this kind of code i'm getting x value as 1.can anyone help me to identify what mistake i have made…

Best Answer

(0<w(5)<255)
You probably mean this:
((0 < w(5)) & (w(5) < 255))
Evaluating yours left to right:
0<w(5)<255
TRUE < 255
TRUE