How to read a STL file with Matlab?

7 views (last 30 days)
Dear all, I would like to convert a STL file with matlab. I use stlread but i can't read the file. Thank you for your help.
Best regards,
  3 Comments
Ababacar Thiam
Ababacar Thiam on 4 Oct 2017
it is a binary file. Finally, i arrive to read the file by changing stlread by stlRead.It runs. Thank's
DGM
DGM on 26 Jun 2025
As of R2018b or newer, MATLAB has a built-in reader:
For a more comprehensive list of alternative options, see this post. This covers the capabilities of 10 different readers found on the FEX. There are probably a few I missed, but these are the ones that came up in search results.
My recommendation is to either use the built-in reader, or use #51200 (stlTools). The above link explains why.

Sign in to comment.

Accepted Answer

Chigozie Nwankpa
Chigozie Nwankpa on 3 Oct 2017
Edited: Walter Roberson on 3 Oct 2017
Hi Abubacar,
I think that you need to plot the surface of the STL file in a mesh.
Sample code might be of help
b = figure(2);
model = stl2matlab('ImageName.stl');
patch(model{1},model{2},model{3},'b');
axis equal; view(30,60);
Wish you luck

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!