Save values in a 2d matrix corresponding to coordinates
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!