4.85714

4.9 | 7 ratings Rate this file 57 downloads (last 30 days) File Size: 4.14 KB File ID: #4512

surf2stl

by Bill McDonald

 

20 Feb 2004 (Updated 24 Feb 2004)

No BSD License  

Write STL file from surface data.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

SURF2STL Write STL file from surface data.
    SURF2STL('filename',X,Y,Z) writes a stereolithography (STL) file
    for a surface with geometry defined by three matrix arguments, X, Y
    and Z. X, Y and Z must be two-dimensional arrays with the same size.
 
    SURF2STL('filename',x,y,Z), uses two vector arguments replacing
    the first two matrix arguments, which must have length(x) = n and
    length(y) = m where [m,n] = size(Z). Note that x corresponds to
    the columns of Z and y corresponds to the rows.
 
    SURF2STL('filename',dx,dy,Z) uses scalar values of dx and dy to
    specify the x and y spacing between grid points.
 
    SURF2STL(...,'mode') may be used to specify the output format.
 
      'binary' - writes in STL binary format (default)
      'ascii' - writes in STL ASCII format
 
    Example:
 
      surf2stl('test.stl',1,1,peaks);
 
    See also SURF.
 
    Author: Bill McDonald, 02-20-04

Acknowledgements
This submission has inspired the following:
patch2stl
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
07 Mar 2006 Mike M

Has good nift. Use with gridgen to make mathematical surfaces into stl files for cfd. mmmm

03 Oct 2007 Amanda L

very neat. Used for converting small pieces of scarcely digitized bone surface point clouds to STL surface which can be loaded into Mimics and Amira.

20 Feb 2008 Yoel Shapiro

Very helpfull! I tried for a long time to open a MATLAB generated mesh or vrml in different 3D environments and couldn't. This did the job.

25 Jul 2008 Max Lingamfelter

Very nice program. Does anyone know a way to write the STL file while keeping other data intact to describe the color?

maxami13@msn.com

19 Aug 2008 Bin Huang

Awesome! It helps me alot.

28 Jan 2009 Daniel Lopes

Thanks Bill! You made a very useful MATLAB function for geometric modeling purposes.
Woks just fine!

02 Mar 2009 Bart Ribbens

Great job! Thanx a lot!

18 May 2009 Zoltan

Nice!
But you could speed it up - it counts at large meshes, if you could find a way to avoid the for loop. For calculating the surface normals, you could use "surfnorm".
Thanks!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Bill McDonald 22 Oct 2008 07:14:42
data export Bill McDonald 22 Oct 2008 07:14:42
stl Bill McDonald 22 Oct 2008 07:14:42
stereolithography Bill McDonald 22 Oct 2008 07:14:42
data Bill McDonald 22 Oct 2008 07:14:42
utilities Bill McDonald 22 Oct 2008 07:14:42
surface data Bill McDonald 22 Oct 2008 07:14:42
potw Shari Freedman 05 Jun 2009 10:49:34
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com