convert S function into Stateflow help
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (0)
See Also
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!