Cant Input Constant to Simulink Bus Assignment Size and Stride

5 ビュー (過去 30 日間)
Linu
Linu 2025 年 4 月 17 日
回答済み: Spruha 2025 年 4 月 24 日
I am currently on Simulink trying to input a std_msgs/Float64MultiArray to a publisher. I have it in a bus assignment block with the inputs of bus, data, layout.dim.size, and layout.dim.stride. The data I am passing is a 1x20 float64multiarray. Since the size and stride is constant, I tried passing those constants to the bus assignment, and I made sure it was type casted to uint32 as those are the data types the size and stride use for std_msgs/multiarray. The error I am getting is Error:The Bus Assignment block 'lidarobjectdetect/Subsystem3/Bus Assignment' could not replace signal 'layout.dim.size', because this signal is inside an array of buses 'layout.dim'. Below shows an image of my setup on Simulink. If anyone could help, that would be great. Thanks.

回答 (1 件)

Spruha
Spruha 2025 年 4 月 24 日
Hi @Linu,
I see you are encountering a Simulink Bus Assignment limitation: ‘You cannot directly assign to a field inside an array of buses using the Bus Assignment block’. This is because ‘layout.dim’ is an array of buses (not a single bus), and Simulink's Bus Assignment block cannot access or assign to fields inside elements of a bus array.
You can use 'MATLAB function' block to construct the entire ‘layout.dim’ array then assign it to bus as whole.
Refer this to learn more about MATLAB Function block: https://www.mathworks.com/help/simulink/slref/matlabfunction.html
Hope this helps!

カテゴリ

Help Center および File ExchangePublishers and Subscribers についてさらに検索

タグ

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by