Why do my Stateflow ouput signal values not persist when set to a value upon entry of a state chart?

27 ビュー (過去 30 日間)
Anthony
Anthony 2025 年 10 月 1 日 21:09
回答済み: Nidhi 2025 年 10 月 17 日 12:39
In these action statements inside a stateflow chart, the local signal values persist across task cycles, but output signal values do not, even though they are only modified in the entry statement, and only in this chart:
en:
IterationSt++; %local signal
IterationSeq++; %local signal
Array2[idx] = CONST_SomeValue; % output signal
counter = 0; % local signal
BooleanOutp = true; %ouput signal
du:
counter++;

回答 (1 件)

Nidhi
Nidhi 2025 年 10 月 17 日 12:39
Hi Anthony,
I understand that in your Stateflow chart the local signals in a Stateflow chart retain their values across simulation steps, while output signals do not.
In Stateflow:
  • Local data (local signals/variables) are stored within the chart and maintain their values across simulation time steps (task cycles). Their values persist unless explicitly changed by chart logic.
  • Output signals are written to during chart execution and then passed to the Simulink environment. After each time step, Simulink resets output signals according to their initial values or the requirements of connected blocks. As a result, output signal values do not persist across time steps unless the chart explicitly assigns them a value at each step.
You can find more information in the following documentation link: https://www.mathworks.com/help/stateflow/ug/typing-stateflow-data.html
I hope this helps!

カテゴリ

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

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by