How To Dynamically Change States In Stateflow?

Issue

This Content is from Stack Overflow. Question asked by Amjad

One way to change states is by connecting a transition from the source state to the destination state. I was wondering if there’s a way to transition to another state by calling a function or by changing some state property. The idea here is that I have a state flow sub chart that needs to connect to many different states in the main chart. Before jumping into the sub chart, I would like to save the next state in a variable and set to that state on exit of the sub chart . My desired behavior:

Name: Last_State_In_Subchart
Entry:SetNextState(SavedState);

Is there a way to do this?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?