フィルターのクリア

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 Center および File ExchangeDeployment, 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