plz. help me TT I want write if(((mp(1)​>0)&(mp(1)​<140))&((m​p(2)>0)&(m​p(2)<140))​)

2 次查看(过去 30 天)
0<mp(1)<140 + 0<mp(2)<140
that write to if(here)
plz TT
if(((mp(1)>0)&(mp(1)<140))&((mp(2)>0)&(mp(2)<140)))
thats incorrect T.T
  1 个评论
Guillaume
Guillaume 2015-10-21
编辑:Guillaume 2015-10-21
What does the '+' mean in your 0<mp(1)<140 + 0<mp(2)<140 expression? While you can add logical expression, I'm fairly certain that's not what you mean.
Your code would be a lot more readable if there wasn't so many unnecessary brackets.
if mp(1) > 0 && mp(1) < 140 && mp(2) > 0 && mp(2) < 140
is exactly the same as you've written but a lot more readable.
Finally, you'll have to explain what 'that's incorrect' means.

请先登录,再进行评论。

采纳的回答

Torsten
Torsten 2015-10-21
if (mp(1) > 0) && (mp(1) < 140) && (mp(2) > 0) && (mp(2) < 140)
...
end
Best wishes
Torsten.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by