%% Create and Access Array of ROS Messages
% You can create an object array to store multiple messages. The array is indexable, similar to any other array. You can modify properties of each object or access specific properties from each element using dot notation.
% Create a two - message object array.

msgArray = [rosmessage('std_msgs/String') rosmessage('std_msgs/String')]

%
% Assign data to individual object elements of the array.

msgArray(1).Data = 'Some string'; 
msgArray(2).Data = 'Other string';

%
% Read all the Data properties from the message objects into a cell array.

allData = {msgArray.Data}

% Copyright 2012 The MathWorks, Inc.
%