X Y Z coordinates matrix

23 vues (au cours des 30 derniers jours)
Andrea Hern{andez
Andrea Hern{andez le 17 Oct 2017
Hi!
I have 3 matrix, one for coordinate x, other for y and other for z. Each one of 2180x10.
I want to have only 1 matrix, where each element of the matriz will be a (x,y,z) point. How can i do that?

Réponse acceptée

Sky Sartorius
Sky Sartorius le 17 Oct 2017
You can use the cat command to 'stack' your three 2d matrices into a single 3d matrix:
M = cat(3,x,y,z);
This will give you a 2180x10x3 matrix, and you can access a single (x,y,z) point using M(m,n,:) (or if you prefer the result be a column vector, squeeze(M(m,n,:))).
  1 commentaire
Andrea Hern{andez
Andrea Hern{andez le 17 Oct 2017
Thank you :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur NaNs 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