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

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

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.
nop i just want a function some reduced thing instead of using loops

댓글을 달려면 로그인하십시오.

 채택된 답변

José-Luis
José-Luis 2013년 12월 4일
b = a;
b(b==1) = 0;

댓글 수: 3

perfect thanx alot
Please accept an answer if it helped you.
sure i just forgot ,, sorry ,, thanx again

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2013년 12월 4일

댓글:

2013년 12월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by