convert S function into Stateflow help

2 views (last 30 days)
Erik
Erik on 17 Sep 2013
I'm trying to take an S function and convert it into a stateflow for-loop chart.
Constant1 = (int)mxGetPr(ssGetSFcnParam(S,0))[0]; Constant2 = (int)mxGetPr(ssGetSFcnParam(S,1))[0]; param = (double *)mxGetPr(ssGetSFcnParam(S,2));
for (i=0;i<Constant1;i++) y[i]=0.0; // init summation
for (i=0;i<Constant2;i++)
{
j=i+Constant2;
k=j+Constant2;
if ( param[k] != 1 ) // subtract from source
y[ (int)param[i]-1 ] -= u[i];
y[ (int)param[j]-1 ] += u[i]; // add
}
}
Can this be done in stateflow? If so any help would be greatly appreciated.

Answers (0)

Categories

Find more on Complex Logic in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!