Hello Hassan,
In Simulink when creating a bus, it requires more information than MATLAB to lock down the message you want to send when it comes to variable size messages. As you might have noticed, 'std_msgs/Int32MultiArray' is one of the variable size messages. To get this to work, you would need to make sure you've done the following to steps:
- Under Simulink->Prepare->VariableSize Messages, click on 'std_msgs/Int32MultiArray', uncheck 'Use default limits for this message type', and write down the correct length (in this case, 16) for the 'Data' field on the right pane.
- Provide the correct length with 'Data_SL_CurrentLength' when you assign values with bus assignment block.
I am not sure which version of MATLAB are you using, but I've attached an image based on R2021a for your reference.
You may also find this page helpful when dealing with ROS messages in Simulink. Hope this helps,
Josh