Converting Simulink Bus with mixed datatypes to an array of doubles

8 views (last 30 days)
Hi,
I've been looking long and hard for a solution to this issue. It's a seemingly simple problem, I have a Simulink bus with a lot of different signals and I need an efficient way of converting this bus with mixed datatypes to a flat (1D) array of doubles. But I can't get it working to fulfill my conditions.
I have tried everything for stateflow charts with matlab functions, to custom matlab functions with a predefined bus object, but nothing works that is efficient enough that can be Code Generated in a reasonable time.
My current solution (more like hack) includes retrieving the hierarchy of the bus using get_param(hdl,'SignalHierarchy') to get the structure of the bus and then convert that to a list and autogenerate an InBus, Cast and OutBus block for each bus signal. This leads to 5 minutes longer build time which isn't really acceptable for my use case.
Any input is appreciated, thank you :)

Answers (1)

Kiran Kintali
Kiran Kintali on 3 Jun 2023
Can you share your current workaround?
I wonder if this block would be of help in your usecase.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!