Main Content


Write blocked point cloud data to new destination

Since R2022a


write(bpc,destination) writes the blocked point cloud data bpc to the location specified by destination.


write(bpc,destination,Name=Value) specifies additional options for writing the blocked point cloud data using name-value arguments.


collapse all

Create a full file path for a LAZ file that contains aerial lidar data.

pcfile = fullfile(toolboxdir("lidar"),"lidardata", ...

Create pcdownsample function handle.

fun = @(block)pcdownsample(block.Data,random=0.1);

Create blockedPointCloud object using the LAZ file.

bpc = blockedPointCloud(pcfile,[50 50]);

Process each block of the aerial point cloud data using the specified pcdownsample function handle.

pcdown = apply(bpc,fun);

Write the downsampled data to a specified destination.


Create a new blockedPointCloud from the output and display its properties.

bpc2 = blockedPointCloud("aerial/aerial/");
  blockedPointCloud with properties:

   Read-only properties.
             Source: "/tmp/Bdoc24a_2528353_1908567/tp233a9fd0/lidar-ex50165705/aerial/aerial"
            Adapter: [1x1 lidar.blocked.LASBlocks]
       SizeInBlocks: [9 6 1]
            XLimits: [4.2975e+05 4.3015e+05]
            YLimits: [3.6798e+06 3.6801e+06]
            ZLimits: [79.4100 124.6200]
    ClassUnderlying: "pointCloud"

   Settable properties
          BlockSize: [50 50 53.0300]

Input Arguments

collapse all

Blocked point cloud, specified as a blockedPointCloud object.

Location to write data, specified as a character vector or string scalar. If you do not specify a full file or folder path, this function creates a folder specified by destination in the present working directory and writes the data in the created folder.

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: write(bpc,destination,DisplayWaitbar=true) displays a wait bar for operations with long run times.

Adapter used for writing blocked point cloud data, specified as an adapter object.

This table lists the adapters included with the toolbox.

LASStore blocks in a single LAS file
LASBlocksStores each block as a LAS file in a folder
MATBlocksStores each block as a MAT file in a folder

Wait bar visualization, specified as a logical 1 (true) or 0 (false). When set to true, the apply object function displays a wait bar operations with long run times. If you cancel the wait bar, the apply object function returns partial output, if available.

Data Types: logical

Version History

Introduced in R2022a