Why Simulink Embedded Coder Reusable functions are generated in Class private section

6 ビュー (過去 30 日間)
Kraker
Kraker 2024 年 5 月 8 日
回答済み: Poorna 2024 年 5 月 16 日
Hi all,
In simulink 2023 i have subsystem defined as resuble function. After code generation this function goes to class private member functions section. I want to use function for other areas/codes. Is there any way create reusable function outside of class?
*2018 version this reusable function created in <modelName>_private.h header file. Can we do same thing in 2023?

回答 (1 件)

Poorna
Poorna 2024 年 5 月 16 日
Hi Kraker,
Reusable subsystem functions are modeled as private member functions of the Model class as far as I know. If possible they will be generated as static private member functions. You can refer to this release notes: https://www.mathworks.com/help/ecoder/release-notes.html?&searchHighlight=#mw_6f37ccc3-f863-4521-99ba-37b24afbcab4
You can modify the Code Interface Packaging setting from "C++ Class" to either "Reusable function" or "NonReusable function" depending on the use case. This will ensure that the subsystem functions are declared in the <Model>_private.h header which will enable you to reuse the functions outside the generated code.
To know more about the Code Interface Packaging setting, refer to the following documentation:
Hope this Helps!

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by