フィルターのクリア

Multiple <,=,> in an if statement?

2 ビュー (過去 30 日間)
Jay
Jay 2014 年 10 月 26 日
コメント済み: Star Strider 2014 年 10 月 26 日
I have the following:
if i > m_1(1,1)& <= m_2(1,1)
w(i,1) = w_2
end
Which doesn't want to execute as it is an unexpected MatLab operator.
Is it due to syntax or do you have to specify domains in another way?

採用された回答

Star Strider
Star Strider 2014 年 10 月 26 日
You have to make the comparisons independent relations:
if i > m_1(1,1) & i <= m_2(1,1)
w(i,1) = w_2
end
So in the first one, it compares ‘i’ to ‘m_(1,1)’, and in the second it makes an independent comparison of ‘i’ with ‘m_2(1,1)’.
  2 件のコメント
Jay
Jay 2014 年 10 月 26 日
Thanks Star for the justification.
Star Strider
Star Strider 2014 年 10 月 26 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by