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
Geoff Hayes
Geoff Hayes 2015 年 1 月 21 日
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