Main Content


Get all available field names from ROS point cloud



fieldnames = readAllFieldNames(pcloud) gets the names of all point fields that are stored in the PointCloud2 object message, pcloud, and returns them in fieldnames.


collapse all

Load sample ROS messages including a ROS point cloud message, ptcloud.


Read all the field names available on the point cloud message.

fieldnames = readAllFieldNames(ptcloud)
fieldnames = 1x4 cell
    {'x'}    {'y'}    {'z'}    {'rgb'}

Input Arguments

collapse all

Point cloud, specified as a PointCloud2 object handle for a 'sensor_msgs/PointCloud2' ROS message.

Output Arguments

collapse all

List of field names in PointCloud2 object, returned as a cell array of character vectors. If no fields exist in the object, fieldname returns an empty cell array.

Introduced in R2019b