필터 지우기
필터 지우기

Display warning only if the "if "statement is not satisfied

조회 수: 1 (최근 30일)
antonet
antonet 2012년 7월 5일
Hi,
I want to create an if statement that will warn me ONLY if the “if “ is NOT satisfied
I tried initially,
if qs1==q2 | qs1==q3
'OK '
else
'Not ok'
End
But this expression displays also “ok” if the if statement is satisfied. I want to get ONLY the warning “not ok” if the “if” statement is NOT satisfied.
If the if statement is satisfied then I do not want to display “ok”
thanks

채택된 답변

Luffy
Luffy 2012년 7월 5일
편집: Luffy 2012년 7월 5일
if ~(qs1==q2 | qs1==q3)
'Not ok'
end
%If u do not like above 1 do this:
if qs1==q2 | qs1==q3
else
'Not ok'
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by