필터 지우기
필터 지우기

How to have both if and else statement to be present in the generated embedded code of a simulink model?

조회 수: 2 (최근 30일)
When I am trying to generate the embedded code of a model, the code for if-else block is not generated. If someone can explain why is this happening and how can I make sure that the code is generated for if-else block every time that will help a lot.

채택된 답변

Sanskar
Sanskar 2023년 7월 5일
Hi Harsh!
This problem happens when you use constant blocks as an input to the if else block in Simulink. The embedded coder takes the input as a constant value rather than variable and thus generate the code for either the if statement or else statement.
To solve this problem change the default parameter behaviour of your simulink model from inlined to tunable. This will make values of constant block as variable rather than constant. Thus the embedded code will be generated for both the cases.
Refer to these documentations for more information on optimization and default parameter behavior.
Hope it helps!

추가 답변 (0개)

카테고리

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

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by