How to generate Defines in the code for Stateflow Parameter/Constant

2 views (last 30 days)
Bogdan Bodnarescu
Bogdan Bodnarescu on 14 Jun 2022
Hello,
I have a Stateflow where I have inputs that are basically uint8 data or boolean data.
Then I have conditions like Input1 == STOP or Input2 == CLOSED
I tried to define STOP, CLOSED both as a Stateflow Constant, or as a Parameter inside the the sldd file.
But in the code even if I configure in the Code Mapping for example STOP to be a Define, the code generator will replace it with its value directly.
I set also to generate Macros for Inlined Parameters, but Embedded Coder seems to have a mind of its own.
The only way to have defines in the Stateflow generated code is to define Simulink Enumerated type for the inputs, and use these types in the conditions in the Stateflow.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by