Structure a complex calculation in boxes rather than in states

2 views (last 30 days)
A complex calculation is structured in small steps inside Stateflow states. As each of these states defines one timestep in simulation, the execution may be accelerated using boxes instead of states.
In this simple example, counters are incremented inside states and boxes, respectively. The states path increments by one per timestep (exept State3, which imitates the implementation of boxes and is highlighted yellow as "unreachable state"), the boxes path takes all incrementations in one single time step.
So, acceleration of calculations works as expected.
But is there more to consider in using boxes for strcuturing complex calculations? Might there occure problems when it comes to code generation?

Accepted Answer

TecBen
TecBen on 30 Mar 2022
A box is a graphical object that defines a namespace that you can use to organize objects in your chart, such as states, functions, and data. Boxes allow you to quickly glance at your chart and recognize which states or functions work together to perform certain tasks. Doc page https://www.mathworks.com/help/releases/R2022a/stateflow/ug/grouping-chart-objects-with-boxes.html
The generated C/C++ code from the chart corresponds to the Stateflow chart simulation results after building auto code from model.

More Answers (0)

Categories

Find more on Stateflow 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!