Replacing the numbers in a matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2017년 4월 11일
편집: Andrei Bobrov
2017년 4월 11일
Let A - your array [22 x 22]
A(bwdist(A==0) <= 1) = 0
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!