Filter löschen
Filter löschen

&& trouble !

17 Ansichten (letzte 30 Tage)
Twinkle
Twinkle am 20 Sep. 2011
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 !
  1 Kommentar
Jan
Jan am 20 Sep. 2011
It is impossible that delta(i) is smaller than zeros *and* greater equal Pi at the same time. Therefore the IF condition is FALSE ever. In addition the reply of ATAN2 is smaller equal Pi ever.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 20 Sep. 2011
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
  1 Kommentar
Twinkle
Twinkle am 21 Sep. 2011
Yeah..i meant that! got it right now ! Anywayz thanks for your help !

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by