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

27 visualizaciones (últimos 30 días)
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++;

Respuestas (1)

Nidhi
Nidhi el 17 de Oct. de 2025 a las 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!

Categorías

Más información sobre Decision Logic en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by