フィルターのクリア

if statemnt do not execute the second statement

4 ビュー (過去 30 日間)
Sergey Dukman
Sergey Dukman 2015 年 8 月 30 日
コメント済み: Sergey Dukman 2015 年 8 月 30 日
Hello, I try to run the following if-statement: if 0<T<10 h=T-10 else T>100 h=0.45*T+900 end. Variable T is defined as T=110. It means that the first condition is false and Matlab have to execute the second condition. But by any reason it does not. Can anyone tell me where I did a mistake?
Best regards, Sergey

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 30 日
編集済み: Azzi Abdelmalek 2015 年 8 月 30 日
if 0<T & T<10
h=T-10
elseif T>100
h=0.45*T+900
end
  1 件のコメント
Sergey Dukman
Sergey Dukman 2015 年 8 月 30 日
Thank you, Sir

サインインしてコメントする。

その他の回答 (1 件)

Steven Lord
Steven Lord 2015 年 8 月 30 日
0<T<10 is always true, since (0<T) returns either 0 or 1 and both are less than 10. It does NOT mean "T is greater than 0 and less than 10"; for that you need to write "0<T & T<10".
  1 件のコメント
Sergey Dukman
Sergey Dukman 2015 年 8 月 30 日
Thank you, Sir!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by