Matrix function for subtracting and adding numbers from values in a matrix
Show older comments
I am trying to make a function that focuses on a matrix. I want the function to subtract 4 from any number in the matrix > 4, and then add 1 to each surrounding number in the matrix, until all numbers are < 4
If the matrix = [0 0 0;0 9 0; 0 0 0]
I want it to change to [0 2 0;2 1 2;0 2 0]
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!