MATLAB: How to get coordinates values X, Y, Z from the Meshed file in matlab to extract coordinates from meshed model I have a meshed bone model(stl file). I have to extract data points (X,Y, Z coordinates) from the model which has 4000 nodes. Can anyone suggest some idea to proceed? Best Answer Something like thisTR = stlread('tristltext.stl');x = TR.Points(:,1);y = TR.Points(:,2);z = TR.Points(:,3); Related SolutionsMATLAB: How could I create stl file based on the ellipsoid command stlwrite only support triangles.You can get the alphaShape of ellipsoid using the alphaShape function.shp = alphaShape(tr.Points)There is also the freeBoundary function.[F,P] = freeBoundary(tr)trNew = triangulation(F,P)stlwrite(trNew, "freeboundary.stl") MATLAB: How to convert a triangulation object into volume and create a BITMAP image Below code is a good example for creating a STL fileĀ for 3D geometry, read the STL as traingulation object, save it as bitmap imageĀ and calculate the volume:Script to create a STL file for 3D geometry. eg: cylinder[X,Y,Z] = cylinder(r,100);DT = delaunayTriangulation(X(:),Y(:),Z(:));TR = triangulation(DT.ConnectivityList,DT.Points);[F,P]=freeBoundary(TR);TR = triangulation(F,P);stlwrite(TR,'stl_test000.stl');Method 1: may not be accurate for complicated shapes%read the stl as a triangulationgm = stlread('stl_test000.stl');% use alphashape to create a bounding volumeshp=alphaShape(gm.Points);plot(shp)% If the plot does not look like the shape that you are expecting, change% the critical radius for the alphashapeshp.Alpha = 5;plot(shp); % this should plot the cylinder. the plot can be saved as a bitmap% Get the volume valueshp.volumeMethod 2: more accurate. Needs PDE Toolboxpdem = createpde;importGeometry(pdem,'stl_test000.stl');% plot the geometry (3D)pdegplot(pdem); % the plot can be saved as a bitmap% mesh the geometry. For more accuracy, adjust the Hmaxmsh = generateMesh(pdem,'Hmax',0.1);% calculate the volumemsh.volume() Related QuestionStl – error too many output argumentsUnrecognized method, property, or field ‘vertices’ for class ‘triangulation’.
Best Answer