Converting Simulink Bus with mixed datatypes to an array of doubles
23 ビュー (過去 30 日間)
古いコメントを表示
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 :)
0 件のコメント
回答 (1 件)
Kiran Kintali
2023 年 6 月 3 日
Can you share your current workaround?
I wonder if this block would be of help in your usecase.
1 件のコメント
Hendrik Noack
2025 年 11 月 28 日 14:16
Bus to Vector conversion might only work for bus where all elements have same type.
Further I'm looking for method to convert each element to double but keep bus structure even nested buses.
Later on need convert back the complete structure to original element types.
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!