How can i call a state machine which is inside a function.Function is called iteratively?

3 views (last 30 days)
Hi ,
I want to call a function inside a loop. The function has a Statemachine in it.
Below is the Pseudo "C" code for which the equivalent stateflow model is required.
for(i=0;i<2;i++)
{
CallStatechart(i);
}
CallStatechart(j)
{
case A:......out[i]=...;
case B:......out[i] =...;
case C:......out[i] =...;
}
  2 Comments
Pradeep Murugan
Pradeep Murugan on 14 Sep 2018
My question is to know if we can have statemachine inside a function.If i am doing it, i am getting an error saying :
"Function 'Fun' contains substate 'A'. This is not allowed"

Sign in to comment.

Answers (1)

Muthukumar Ganesan
Muthukumar Ganesan on 1 Aug 2022
Hi,
This requirement can be achieved by implementing the statemachine inside the "For Iterator Subsystem" in simulink. Please refer to the attachment.
Thanks.

Categories

Find more on Stateflow in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!