if i want to change each value 1 in a matrix to 0 how to do that?

1 Ansicht (letzte 30 Tage)
a=[1 2 3;1 3 3;2 1 2]
is there a function that make a as below
b=[0 2 3;0 3 3;2 0 2]
  2 Kommentare
José-Luis
José-Luis am 4 Dez. 2013
Is this homework?
This can be solved with a combination of loops (for) and conditional statements (if), or in a syntactically simpler way with logical indexing.
mary
mary am 4 Dez. 2013
nop i just want a function some reduced thing instead of using loops

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

José-Luis
José-Luis am 4 Dez. 2013
b = a;
b(b==1) = 0;
  3 Kommentare
José-Luis
José-Luis am 4 Dez. 2013
Please accept an answer if it helped you.
mary
mary am 7 Dez. 2013
sure i just forgot ,, sorry ,, thanx again

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by