replace array value

1 vue (au cours des 30 derniers jours)
Mohammad Golam Kibria
Mohammad Golam Kibria le 5 Mai 2011
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?

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 5 Mai 2011
  3 commentaires
Oleg Komarov
Oleg Komarov le 5 Mai 2011
A(A(:,2)==6,2) = 12;
Mohammad Golam Kibria
Mohammad Golam Kibria le 8 Mai 2011
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by