Clear Filters
Clear Filters

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

3 views (last 30 days)
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?

Answers (1)

Poorna
Poorna on 16 May 2024
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!

Community Treasure Hunt

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

Start Hunting!