Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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 Kommentar
Guillaume
Guillaume am 21 Okt. 2015
Bearbeitet: Guillaume am 21 Okt. 2015
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 21 Okt. 2015
if (mp(1) > 0) && (mp(1) < 140) && (mp(2) > 0) && (mp(2) < 140)
...
end
Best wishes
Torsten.
  2 Kommentare
Guillaume
Guillaume am 21 Okt. 2015
Other than being more readable, how is this different from the original code that's been specified as not correct?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by