%% Create ROS Publisher and Send Data
% Start ROS master.

rosinit

%
% Create publisher for the '/chatter' topic with the 'std_msgs/String' message type.

chatpub = rospublisher('/chatter','std_msgs/String');

%
% Create a message to send. Specify the Data property.

msg = rosmessage(chatpub);
msg.Data = 'test phrase';

%
% Send the message via the publisher.

send(chatpub,msg);

%
% Shut down the ROS network.

rosshutdown

% Copyright 2019 The MathWorks, Inc.