Connecting like numbers in a matrix
3 views (last 30 days)
Show older comments
Suppose I have a matrix of the following data:
data = [6, 5, 3, 0, 0, 1; ...
0, 0, 0, 0, 0, 2; ...
0, 0, 0, 0, 0, 4; ...
0, 0, 0, 0, 0, 0; ...
6, 0, 0, 0, 0, 0; ...
5, 0, 4, 0, 0, 0]
What I would like to do is find the like entries that I can connect directly to by remaining on the edges of the matrix. So for instance, after applying this function I should get
newdata = [6, 5, 3, 0, 0, 1; ...
6, 0, 0, 0, 0, 2; ...
6, 0, 0, 0, 0, 4; ...
6, 0, 0, 0, 0, 4; ...
6, 0, 0, 0, 0, 4; ...
5, 0, 4, 4, 4, 4]
2 Comments
Answers (0)
See Also
Categories
Find more on Title in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!