This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

stlread

Create triangulation from STL file

Syntax

TR = stlread(filename)
[TR,fileformat,attributes,solidID] = stlread(filename)

Description

example

TR = stlread(filename) returns a triangulation object TR containing the triangles defined in an STL file.

[TR,fileformat,attributes,solidID] = stlread(filename) also returns the file format of filename, attributes when the file is binary, and solid identification numbers when the file is text.

Examples

collapse all

Create and plot a triangulation object from the data contained in the file tristltext.stl.

TR = stlread('tristltext.stl');
triplot(TR)

Input Arguments

collapse all

STL file name, specified as a character vector or scalar string. The file name must end with the .stl or .STL extension. If the file contains degenerate triangles, then stlread automatically removes them.

Example: 'stltextfile.stl'

Output Arguments

collapse all

Triangulation, returned as a triangulation object.

File format, returned as either 'binary' or 'text'.

Binary attributes, returned as a uint16 vector. When the input file is binary, attributes contains coded information about the triangles. Its length is equal to the number of triangles in the triangulation. If the input file is a text file, then attributes is an empty array.

Solid grouping index, returned as a vector of identification numbers. When the input file is a text file, the identification numbers assign each triangle to a grouping of triangles in the triangulation. When the input file is binary, solidID contains all ones. The length of solidID is equal to the number of triangles in the triangulation.

Data Types: double

Introduced in R2018b