reconstruct matrix from vector coordinates
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
sz = [max(x),max(y)];
ix = sub2ind(sz,x,y);
mat = NaN(sz);
mat(ix) = data;
3 commentaires
Nicolas
le 25 Jan 2017
Walter Roberson
le 25 Jan 2017
Your x and y are not indices in the MATLAB sense.
Nicolas
le 25 Jan 2017
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!