Rebuild a matrix from indices
Show older comments
Hi everyone! After I extracted the indices from a matrix, I´d like to rebuild it and store other data in the places marked by the indices. For example, if I had
A = [0 2 2 0 0 ; 2 0 0 2 2 ; 0 2 0 2 2 ; 0 0 0 2 2 ; 2 2 0 2 2];
[i,j] = find(A==2);
I get the indices where the 2's are in the matrix (i for rows and j for columns). What I'm trying to do is change the value of the 2's and store data in that positions. That data has the same indices i and j (they are coordinates UTM). I'm working on a big matrix, around 5000x5000. Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays 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!