reconstruct matrix from vector coordinates
显示 更早的评论
Hello, I have 3 vectors (x,y,data) each equals 1x6358. How can I recreate the matrix DATA based on the indices x and y? Thank you
采纳的回答
更多回答(1 个)
sz = [max(x),max(y)];
ix = sub2ind(sz,x,y);
mat = NaN(sz);
mat(ix) = data;
3 个评论
Nicolas
2017-1-25
Walter Roberson
2017-1-25
Your x and y are not indices in the MATLAB sense.
Nicolas
2017-1-25
类别
在 帮助中心 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!