replace array value

조회 수: 4 (최근 30일)
Mohammad Golam Kibria
Mohammad Golam Kibria 2011년 5월 5일
I have a matrix
A=[1 2 3; 4 6 6;7 7 7]
I want to replace all 6 in the second column with 12 i.e A should be
as follows: A=[1 2 3; 4 12 12;7 7 7]
How to do that easily?

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 5월 5일
  댓글 수: 3
Oleg Komarov
Oleg Komarov 2011년 5월 5일
A(A(:,2)==6,2) = 12;
Mohammad Golam Kibria
Mohammad Golam Kibria 2011년 5월 8일
Thanks

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by