How do I reduce the size of the functions generated using the Stateflow Coder 4.2 (R12.1+)?

3 views (last 30 days)
I have generated code from a Stateflow chart and there are a few small functions and a very large void function. This is a big problem because many embedded compilers, such as Hitachi, refuse to compile functions that are too large. I would like to know how to reduce the size of this function.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 1 Apr 2013
If you are using Stateflow 4.2 (R12.1+), you can set both minimum and maximum thresholds as follows:
sfc('coder_options','inlineThreshold',10) % only functions with < 10 statements get inlined
sfc('coder_options','inlineThresholdMax',100) % if caller has > 100 statements, no more inlining done
The values used for the parameters above are just examples and actual numbers would be user specific.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!