How can I have Model InitFcn Callback generated in model Init function using Embedded Coder?

I have a model which is doing:
output = input + par_init + par_edit
  • par_edit: shall be tunable, to set this value externaly before running the generated code. 
  • par_init, is calculated from the first parameter par_edit, and defined in Simulink in the Model-Callback InitFcn.
The generated code looks like
/* Model step function */ void ModelInit_step(void) { ModelInit_Y.Out1 = (ModelInit_U.In1 + 6.123233995736766E-17) + par_edit; } /* Model initialize function */ void ModelInit_initialize(void) { }
How can I have Model InitFcn Callback generated in model Init function?

 채택된 답변

Model initialize function code could be generated in the following methods:
  • Using the Initialize Function, which executes contents on a model initialize event, instead of the model callback InitFcn. To access the release-specific documentation in MATLAB R2019b, please run the following command in the command window:
    >> web(fullfile(docroot, 'simulink/slref/initializefunction.html'))
  • By specifying Configuration Parameters > Code Generation > Custom code to include in the generated model. To view the relevant documentation in MATLAB R2019b, execute the following command:
    >> web(fullfile(docroot, 'rtw/ref/initialize-function.html'))
Please follow the below link to search for the required information regarding the current release:

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품

릴리스

R2019b

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by