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!