Formula if with few statements

2 ビュー (過去 30 日間)
ZK
ZK 2013 年 4 月 25 日
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

採用された回答

Jan
Jan 2013 年 4 月 25 日
編集済み: Jan 2013 年 4 月 25 日
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 件のコメント
ZK
ZK 2013 年 4 月 25 日
Thanks for tips, working fine.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by