Why does Stateflow Coder 6.0 (R2007a) generate more than one function for certain Stateflow charts?

2 views (last 30 days)
Stateflow Coder generates code as one function when the Stateflow chart is small. However, when the chart is large, Stateflow Coder generates the code as two or more functions.
I would like to know how Stateflow makes this decision?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
Stateflow categorizes a chart as being small, when there are no exported functions and chart execute at initialization is not 'on'. As part of the internal working of Stateflow Coder, during code generation, several intermediate functions are generated which are later inlined. Therefore, when code is generated from a 'small' chart, the final code consists of a single function.
Based on certain internal metrics such as the size of functions and the amount of stack space being created, a chart may sometimes be categorized as a 'large' chart. In such a scenario, Stateflow Coder may not inline all the functions, therefore leading to multiple functions to represent a single chart in the generated code.
Currently, the user does not have the ability to control the number of functions that are generated from a Stateflow Chart. User control is limited to specifying whether individual graphical functions should be inlined.

More Answers (0)

Categories

Find more on Stateflow in Help Center and File Exchange

Tags

Products


Release

R2007a

Community Treasure Hunt

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

Start Hunting!