Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
enter in the if clause only in certain situation
조회 수: 1 (최근 30일)
이전 댓글 표시
I would execute a block only if I have this vector
A=[1 0]
instead if I'd have A=[0 0] or A=[1 1] if clause shouldn't be executed. I tried using any or all functions but I'm little confused with their use...
댓글 수: 1
답변 (1개)
Andrew Barton
2012년 9월 20일
I think all(A==[1 0]) is what you're looking for. A==[1,0] returns a 1x2 array where the first element is true if A(1) == 1, and the second element is true if A(2) == 0. All takes that 1x2 array and only returns true if each of its elements are true.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!