You can now create messages as structures with fields matching the message object
properties. Using structures typically improves performance of creating, updating, and using
ROS messages, but message fields are no longer validated when set. Message types and
corresponding field values from the structures are validated when sent across the
network.
To use ROS messages as structures, use the "DataFormat" name-value
argument when creating your publishers, subscribers, or other ROS objects. Any messages
generated from these objects will utilize structures.
pub = rospublisher("/scan","sensor_msgs/LaserScan","DataFormat","struct")
msg = rosmessage(pub)
You can also create messages as structures directly, but make sure to specify the data
format as "struct" for the publisher, subscriber, or other ROS objects as
well. ROS objects still use message objects by default.
msg = rosmessage("/scan","sensor_msgs/LaserScan","DataFormat","struct")
...
pub = rospublisher("/scan","sensor_msgs/LaserScan","DataFormat","struct")
In a future release, ROS messages will use structures by default and ROS message objects
will be removed.