How to control/customize the initialize function generation from simulink model?

조회 수: 6 (최근 30일)
Hello,
I am generating the C codes form the simulink models using the Embedded Coder target. I want to know that, is there any way to control the model_initialize and model_step function generation. I founf that the code mapping Editor useful controlling the names and arguments of the mentioned functions.
Requirement :
Instaed of generating the two individual functions, the single function step/init function with all the code compressed in it.
Please help me with the possible ways of acheiving it.
Thanks in advance.

답변 (1개)

Kanishk
Kanishk 2025년 1월 22일
While generating C code, the code generation process typically includes the “initialize”, “step” and “terminate” functions. There is currently no option or flag to combine the “initialize” and “step” functions into a single function.
You can workaround this by using a post processing script to identify the contents of “initialize” and “step” functions in the C/C++ file using regular expressions and combine them in a custom function. You also need to take care of the declaration, and any function calls in the header and other code files.
You can learn more about regular expressions in MATLAB from the documentation which can be accessed by this command.
web(fullfile(docroot, 'matlab/matlab_prog/regular-expressions.html'))

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by