Main Content

readAllFieldNames

Get all available field names from ROS point cloud

Description

example

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

Note

readAllFieldNames will be removed. Use rosReadAllFieldNames instead. For more information, see ROS Message Structure Functions

Examples

collapse all

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

exampleHelperROSLoadMessages

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.

Compatibility Considerations

expand all

Not recommended starting in R2021a

Introduced in R2019b