How can I upgrade a model with a chart parented temporary scope data to Stateflow 6.0 (R14) and later?

1 view (last 30 days)
I have a model that uses chart parented temporary scope data created in Stateflow 5.1.1 (R13SP1). Chart parented temporary scope data was made obsolete in R14. When I open my model in R14 and later, the temporary scope data gets marked as local scope data. This results in a change in behavior, since unlike temporary scope data the local scope data retains its value for successive chart activations. I would like to know how I can upgrade my model without changing its behavior related to the use of temporary scope data.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
Chart parented temporary scope data was made obsolete in Stateflow 6.0. The decision to retire chart-parented “Temporary” data was based on the following premises:
1. “Temporary” data in charts with states were equivalent to “Local” data prior to R14.
2. If the “Local” data are always initialized explicitly on the diagram before they are “read”, then one of the code optimizations implemented in Stateflow 6.0 (R14) automatically makes them into temporary data in the generated code. This optimization works in charts with states as well.
3. Old models containing temporary data in charts without states would behave exactly the same as they are most likely initialized before their use in the flow-graph.
Thus, it was concluded that the chart-parented “Temporary” data in old models could be mapped to “Local” data in R14 without resulting in any backward compatibility problems. However, the third premise above was incomplete as it failed to account for those models which have charts without states where temporary data are not explicitly initialized on the diagram before their use. For such cases, in order to ensure similar behavior one of the following changes needs to be made to the chart:
1. Explicitly initialize the data in the chart
2. Enclose the entire flow-graph in a graphical function and call the graphical function from a single default-transition in the chart

More Answers (0)

Categories

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