Cant Input Constant to Simulink Bus Assignment Size and Stride

5 Ansichten (letzte 30 Tage)
Linu
Linu am 17 Apr. 2025
Beantwortet: Spruha am 24 Apr. 2025
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.

Antworten (1)

Spruha
Spruha am 24 Apr. 2025
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!

Kategorien

Mehr zu Publishers and Subscribers finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by