0

I have seen the following link to create cube with 3D mesh. How to plot 3D grid (cube) in Matlab This is very useful. Can anybody answer how to export the geometrical coordinates of each mesh element in the for of array. Array should consist of A=A1;A2:A3.. where A1=x1,y1,z1 A2=x2,y2,z2....

Thanks

Community
  • 1
  • 1
  • 1
    you mean something like [meshgrid](http://se.mathworks.com/help/matlab/ref/meshgrid.html?refresh=true)? – patrik Feb 02 '15 at 13:40

1 Answers1

0

[X, Y, Z]=meshgrid(sx:ex, sy:ey, sz:ez); will created three matrices the same size as your grid with x, y, z coordinates of each point.

To get these into a single matrix you can first reshape them into a column vector using x=reshape(X, numel(X), 1); and similar for y and z. Unless you do something odd the ordering should be consistent between the three.

The just stitch the three columns together if you need to. A=[x, y, z];

nivag
  • 573
  • 2
  • 8