Create .xyz file from grid data

12 visualizaciones (últimos 30 días)
Laxmikant Mane
Laxmikant Mane el 28 de Abr. de 2021
Comentada: Jacob Valdes el 18 de Jun. de 2021
I have data x(100x1), y(100x1), z(100x100). How can I get data in triplet form (x,y,z)?

Respuestas (1)

Pratyush Roy
Pratyush Roy el 13 de Mayo de 2021
Hi Laxmikant,
You can use the meshgrid to create 2D grids in the X-Y plane and the concat function to concatenate the grid with the Z values. The code snippet below might be helpful to get the data in triplet form:
[X,Y] = meshgrid(x,y);
data = concat(3,X,Y,z); % Here 3 refers to 3rd dimension along which we are concatenating the arrays
triplet_11 = data(1,1,:); % Triplet value at index (1,1) . To obtain triplet at position (i,j) we can use data(i,j,:)
Hope this helps!
  1 comentario
Jacob Valdes
Jacob Valdes el 18 de Jun. de 2021
Undefined function 'concat' for input arguments of type 'double'.

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by