reconstruct matrix from vector coordinates
Show older comments
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
Accepted Answer
More Answers (1)
sz = [max(x),max(y)];
ix = sub2ind(sz,x,y);
mat = NaN(sz);
mat(ix) = data;
3 Comments
Nicolas
on 25 Jan 2017
Walter Roberson
on 25 Jan 2017
Your x and y are not indices in the MATLAB sense.
Nicolas
on 25 Jan 2017
Categories
Find more on Descriptive Statistics 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!