Hi, I want to run an If function. So if x<3 then I want function "Runningwater" to be executed. How can I implement this as code?
thanks guys

 채택된 답변

Geoff Hayes
Geoff Hayes 2015년 1월 21일

2 개 추천

AA - conditional control with an if, see flow control for details, can be written as
if x < 3
Running water;
end

댓글 수: 2

AA
AA 2015년 1월 21일
thanks and how about if i want an 'or' or 'and' condition.
if x<3 "and" y>4 Running water; end
or
if x<3 "or" y>4 Running water; end
The double ampersand is used for and, and the double pipe for or. For the and, you would do
if x<3 && y>4
Runningwater;
end
For the or, you would do
if x<3 || y>4
Runningwater;
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

AA
2015년 1월 21일

댓글:

2015년 1월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by