- Place a "Data Store Memory" block in your Simulink model outside of the Stateflow chart. This block will serve as a shared memory resource.
- Change the "Data type" to "double" and "Signal Type" to "real" of "Data Store Memory" block.
- In the Stateflow chart, add a data object and configure it as "Data Store Memory" using the Symbols pane. This allows the chart to access the shared memory.
- Within Simulink-based states, utilize "Data Store Read" and "Data Store Write" blocks to access and modify the shared memory. These blocks enable interaction with the data store memory object.
- https://www.mathworks.com/help/releases/R2022b/simulink/slref/datastorememory.html
- https://www.mathworks.com/help/releases/R2022b/stateflow/ug/access-data-store-memory-from-a-chart.html