Save values in a 2d matrix corresponding to coordinates
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?
I have three sets of data x,y and values
simplified
x = [1, 5, 6, 7]
y = [1, 4, 6, 4]
values = [5, 3, 4, 6]
where value of 5 is located at point (1,1)
I have earlier asked this question and gotten the
accumarray ([x(:),y(:)],values(:))
which works fine with the simplified values. The problem is that my x and y coordinates are decimals, and I wish to keep them this way. Is there a way around this problem in accumarray or some other example of how this can be done?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB 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!