Hello everyone.How to modify the judgment code below and add'This is correct' and'This is wrong'?

1 回表示 (過去 30 日間)
Wesley
Wesley 2020 年 12 月 16 日
回答済み: Rik 2020 年 12 月 21 日
lamda1=4;
v=('This is correct');Ak = ('This is wrong');
if 0.125<lamda1<3
lamda1=v;
else
lamda1 =Ak;
end
  1 件のコメント
Abhishek Gupta
Abhishek Gupta 2020 年 12 月 21 日
Hi,
Can you please elaborate your question? I see that you are updating the value of 'lamda1' based on its original value. But, what is it that you would like to achieve finally?

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

回答 (1 件)

Rik
Rik 2020 年 12 月 21 日
As mlint is already warning you: 0.125<lamda1<3 is not doing what you think it does. Use this instead:
if 0.125<lamda1 && lambda1<3

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by