Persistent Data in Stateflow

11 ビュー (過去 30 日間)
John Fiaschetti
John Fiaschetti 2021 年 5 月 24 日
回答済み: Jonas 2021 年 5 月 25 日
Hi,
I am trying to save a value across executions of a state chart. However, each time I call the chart, the value is reset to zero. I have tried using a memory or unit delay block outside the chart as well as a Data Store. Both methods don't seem to work.
Any ideas?

採用された回答

Jonas
Jonas 2021 年 5 月 25 日
Variables you define as 'local' or as 'output' in the chart are persistent over chart executions.
They will take on their initial values again when you put the chart for example in an enabled subsystem and its 'States when enabling' is set to 'reset'. Also, when you check 'Initialize outputs every time chart wakes up' it could be that the outputs are not saved persistently.
I honestly don't really know what you could be doing wrong, since the whole purpose of a 'state' flow is to remember its state, together with variables you define.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by