Question
I wonder that how can I handle the array type of ROS messages for subscribing or publishing. For example, I want to publish [ 350 x 2 ] type of ROS message. To publish ROS msg, I have to assign my data to ROS-supported-type using "Blank Message Block" like std_msgs/Float64 or customized message type. It seems like that I have to use "std_msgs/Float64MultiArray" type to publish [ 350 x 2 ] ROS msg. I want to know that this is right. And if it is right or not, please let me know the way.
Expert Answer
John Williams
PhD Expert
Answered Aug 22, 2026
It looks like the std_msgs/Float64MultiArray should be able to handle the array of data you are looking to provide it. Note, however, that none of the data shaping is done automatically. You will need to convert it to a 1-D array to provide to the "Data" field of the Float64MultiArray message, and then provide any metadata you want to the Layout field about how to transform it back into its expected shape. The transformation back from 1x700 to 350x2 will need to be done on the other end (where you subscribe to the message), preferably using the metadata provided (since that will be most modular if you change the array size later).
Also, since the Float64MultiArray contains a variable size array, you will need to Manage Array Sizes in Simulink to allow it to handle all 700 elements.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related ros Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →