Replacing the numbers in a matrix
Mostrar comentarios más antiguos
I have a matrix of numbers (22 x 22). Some of the numbers in the cells are zero. If the cell contains a zero, I want to replace in the numbers in the cells directly above, below, to the right and left also with a zero.
Respuesta aceptada
Más respuestas (1)
Andrei Bobrov
el 11 de Abr. de 2017
Editada: Andrei Bobrov
el 11 de Abr. de 2017
Let A - your array [22 x 22]
A(bwdist(A==0) <= 1) = 0
Categorías
Más información sobre Fixed-Point Operator Replacement en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!