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.


Write 3-D point cloud to PLY or PCD file





pcwrite(ptCloud,filename) writes the point cloud object, ptCloud, to the PLY or PCD file specified by the input filename character vector.

pcwrite(ptCloud,filename,'Encoding',encodingType) writes a pointCloud object, ptCloud, to a PLY file that is in the specified format.


collapse all

ptCloud = pcread('teapot.ply');

pc = pcread('object3d.pcd');

Input Arguments

collapse all

File name, specified as a character vector. The input file type must be a PLY or PCD format file.

For a PLY-file, the pcwrite function converts an organized M-by-N-by-3 point cloud to an unorganized M-by-3 format. It converts the format because PLY files do not support organized point clouds. To preserve the organized format, you can save the point cloud as a PCD-file.

If you do not specify the file name with an extension, the function writes the file in a PLY-format.

Object for storing point cloud, specified as a pointCloud object.

PLY or PCD formatted file, specified as the comma-separated pair consisting of the character vector 'Encoding', and a character vector for the file format.

File FormatValid Encodings
PLY'ascii', 'binary'
PCD'ascii', 'binary', or 'compressed'

Introduced in R2015a