Why Simulink Embedded Coder Reusable functions are generated in Class private section
6 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!