File Exchange

image thumbnail


version 1.0 (1.8 KB) by

Read STL file into MATLAB patch compatible matrixes.

10 Ratings



No License

This function reads a binary SPL file into X, Y, Z, C matrixes compatible with the MATLAB patch function.

See, , for more information on the format.

Comments and Ratings (15)

Yanyu Peng

nice code

Zi Tao

Zi Tao (view profile)


agdfg sdgfdg

when i'm using above code .I'm getting Error using stlread (line 16)
Not enough input arguments.
16---fid=fopen....highlighting fid


Please, anyone knows why do I get this MatLab errors when I try to read my STL file?

Title: solid BVMESH

facet normal 0.248 -0.299 0.922

outer loop

Num Facets: 775500593
??? Error using ==> zeros
Maximum variable size allowed by the program is exceeded.

Error in ==> stlread at 28
x=zeros(3,num_facet); y=zeros(3,num_facet); z=zeros(3,num_facet);

Thank you...

Althought a little slow is very useful to import stl ascii files, I think the slowness dependes on not preallocate arrays in the importation loop.

prasad k

thanks for this code
it is very useful to me
once again thanks

Abir Chakraborty

Works exactly as needed. Saves lot of time. Thanks a lot.

Tom Price

Works very nice. Thanks.

Reviewing M Files

For all the trial stl files used I get the "Error using ==> zeros
Product of dimensions is greater than maximum integer."
Please enlighten. Thanks

Reviewing M Files

Title: solid MyObj
facet normal 0.955654E-01 -0.966960E+00 0.236339E+00
Num Facets: 1886351212
??? Error using ==> zeros
Product of dimensions is greater than maximum integer.

Error in ==> E:\MyDownloads\stlread.m
On line 28 ==> x=zeros(3,num_facet); y=zeros(3,num_facet); z=zeros(3,num_facet);

Christophe Henrard

Works perfectly fine! Thank you

Zoltan Sarosi

Very good! It is exactly I was looking for. Thank you!

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video