How do I create a simulator to scan a matrix and switch some of the elements in it?
이전 댓글 표시
I want to create a simulator with for loops to simulate this scenario.
For example, I have a 20x20 matrix with 1s or 0s, and I want to find how many 1s are there around every 1 and 0. If there is 2 or 3 1s around 1, then this '1' will be kept, otherwise, it will be turned into a 0 in the next step. As for 0s, if there is exact three 1s around it, it will be turned to a 1, otherwise it will still be 0.
I tried to use a filter to make this happen, but failed.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!