Why does the Stateflow Coder generate wrong code when the "Seperate arguments for input/out data" option is selected in Stateflow?

1 view (last 30 days)
Why does the Stateflow Coder generate wrong code when the "Seperate arguments for input/out data" option is selected in Stateflow 4.1 (R12.1)?
If I select the "Seperate arguments for input/out data" option in Stateflow 4.1 (R12.1), Stateflow Coder will make the following chart.c function:
void chart(void)
{
{
/* During: Chart */
if(chartInstance.State.is_active_chart == 0) {
/* Entry: Chart */
chartInstance.State.is_active_chart = 1;
/* Entry: a */
chartInstance.State.is_chart = IN_c1_s1_a;
out = in;
}
}
}
Now when I generate code on Stateflow 4.0, 4.0.1 or 4.0.2 (R12) with the following options:
* Uncheck the 'Pack input/output data into structures' option
* Uncheck the 'Use global input/output data (no packing)' option
(This is the same as the "Seperate arguments for input/out data" option in Stateflow 4.1).
Stateflow Coder will make the following code:
void chart(real_T in,real_T *sf_out_Ptr)
{
if(chartInstance.State.is_active_chart==0) {
chartInstance.State.is_active_chart=1;
chartInstance.State.is_chart=IN_c1_s1_a;
out = in;
}
}
The generated code from Stateflow 4.1 (or 4.0.3 and 4.0.4) is not correct because the chart function has a "void" argument.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This is a bug in Stateflow 4.0.3 (R12+) and beyond. This will be fixed in a future version of Stateflow.
Currently, there are no known workarounds.

More 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!