Why do I get this result??
古いコメントを表示
Hello
I have a problem with this code
k=2*A+3*B
if k<3.65
fr='inf'
elseif 3.65<k<=4.35
fr='moy'
elseif k>4.35
fr='sup'
end
why i get this result 'moy'?? it must be 'sup'
k =
6.4582
fr =
moy
Can you help me to correct this code.
採用された回答
その他の回答 (2 件)
David Barry
2012 年 11 月 7 日
Try this
k=2*A+3*B
if k<3.65
fr='inf'
elseif k >= 3.65 && k<= 4.35
fr='moy'
elseif k>4.35
fr='sup'
end
3 件のコメント
David Barry
2012 年 11 月 7 日
Looks like Evan beat me to it. && is MATLAB command for logical AND.
David Barry
2012 年 11 月 7 日
Also note that I have changed your code to cope when k = 3.65
Evan
2012 年 11 月 7 日
Good catch. I didn't notice that. I've updated my post to account for that issue, but credit goes to you. :)
Sean de Wolski
2012 年 11 月 7 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Filter Analysis についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!