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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by