MATLAB: && trouble !

if statement

if i make an array of delta(i) such that delta(i)=atan2(x,z) then the code: if ((delta(i)<0) && (delta>=pi)) delta(i)=2*pi+delta(i);
gives error: operands && operators must be convertible to logical scalar values
help me out if u can !

Best Answer

delta is apparently an array with more than one element so in the second part of the conditional delta>pi will also be non-scalar. You probably meant
delta(i)>=pi
Related Question