How do I create a simulator to scan a matrix and switch some of the elements in it?
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Operating on Diagonal Matrices 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!