Formula if with few statements

2 Ansichten (letzte 30 Tage)
ZK
ZK am 25 Apr. 2013
Hi
I would like to create a multiple statement in loop if containing an 'or' and 'and'. Is this possible to have a few && and 'or' in one statement? Like:
if A>2 && [(B1>Z && B2<Z) or (C1>Z && C2<Z)]
Thanks

Akzeptierte Antwort

Jan
Jan am 25 Apr. 2013
Bearbeitet: Jan am 25 Apr. 2013
While the combination of && and || works properly, creating a vector by the square brackets is most likely not wanted.
if A>2 && ((B1>Z && B2<Z) || (C1>Z && C2<Z))
Note that the variables must be scalar for && and ||, otherwise use and() or or(), or the eqivalent & and | operators.
  1 Kommentar
ZK
ZK am 25 Apr. 2013
Thanks for tips, working fine.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by