Code generation and stateflow transition variant
3 views (last 30 days)
Show older comments
Hello,
Is the code generation tunable with a transition variant, set with "Variant Activation Time = Code compile" with r2024b?
Indeed, I have a compilation warning with my generated code. The code generation creates a static function with #if inside the function:

This way, the compilation gives a compilation warning saying that there is a function defined but not used.
If you have a solution, I am interested.
Regards,
Jean
0 Comments
Answers (1)
Githin George
on 11 Apr 2025
The following example Control Indicator Lamp Dimmer Using Variant Conditions and the documentation Options to Represent Variant Parameters in Generated Code may help you understand the capabilities for code generation with variant transitions in Stateflow.
Based on the documentation I do believe that variant transition can be generated as tunable. As for the compiler warning I am confused because the static function would be called based on the logic you have implemented. You can go through the generated code from the example provided to see if it helps.
Otherwise you could provide a reproduction model to better understand the warning message.
0 Comments
See Also
Categories
Find more on Decision Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!