Checking if sides of triangle are positive and if equality rule is satisfied.
조회 수: 7 (최근 30일)
이전 댓글 표시
So, I could easily do this using multiple if statements but that seems fairly repetitive. Is there an and or operator in MATLAB so that I could say: if a <= 0 and or b <= 0 and or c <= 0 error... end
And, then do a similar thing with the equality. Sorry for the fairly simple questions, first week or so using MATLAB.
댓글 수: 0
채택된 답변
Matt J
2013년 10월 2일
if any([a,b,c]<=0)
댓글 수: 9
Matt J
2013년 10월 2일
편집: Matt J
2013년 10월 2일
I can't tell what it's attempting to test. That's what I meant when I said it doesn't make sense.
Aside from that, though, if you run it, you will get an error. The short-circuited logical operators "&&" and "||" only apply to scalar expressions, not vectors.
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!