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 CenterFile Exchange에서 Publishers and Subscribers에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by