Effacer les filtres
Effacer les filtres

Convert gridded data to coordinate matrix

6 vues (au cours des 30 derniers jours)
Kai le 21 Août 2018
Commenté : Kai le 21 Août 2018
Hello, I was wondering if there is some Matlab command to convert gridded data to a coordinate matrix. For instance, I have
X = -1:0.2:1;
Y = -1:0.2:1;
M = rand(11,11);
and M(i,j) represents the z-value of (X(i),Y(j)) (which is random in here, but usually this will be the value under some function F(x,y) of course). Now I would like to convert M to a matrix C of size 11*11 times 3, each row giving the coordinates of one grid point specified by M. I could run some for-loops and define the rows one by one, but I was wondering if there is some specific Matlab command for this.

Réponse acceptée

Julie le 21 Août 2018
  4 commentaires
Julie le 21 Août 2018
Kai le 21 Août 2018
Perfect, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)


En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by