How can I save values in a 2d matrix corresponding to coordinates?
2 views (last 30 days)
Show older comments
I have a set of values that correspond to certain coordinates on a grid. How can I create a matrix that stores these values in the corresponding location, with blank values for all other points on the matrix?
For example, if I had
values = [1, 5, 22, 13, 8] x = [2, 4, 3, 3, 1] Y = [1, 5, 4, 3, 5]
Where a value of 1 is at coordinates (2,1), value of 5 is at (4,5), etc.
So the result would be something like
0 1 0 0 0
0 0 0 0 0
0 0 13 0 0
0 0 22 0 0
8 0 0 5 0
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!