clear pid
clear msg
clear ans

% create a publisher that publishes a geometry_msgs/Twist message
pid=geometry_msgs_PoseWithCovariance(...
    'connect','subscriber','example_module','PoseWithCovariance');

% create an empty geometry_msgs/Twist message structure
msg=geometry_msgs_PoseWithCovariance('empty');

% read a message and print to screen
while (1)
    msg = geometry_msgs_PoseWithCovariance('read',pid,100);
    if ~isempty(msg)
      msg.pose.position.x
      msg.pose.position.y
      msg.pose.position.z
      msg.covariance(1)
      msg.covariance(6)
    end
end
