|On this page…|
Charts have an action language property that defines the syntax for state and transition actions. MATLAB® is the default action language syntax for new Stateflow® charts. These charts have a MATLAB icon in the lower-left corner.
Charts can also use C as the action language syntax. These charts have a C icon in the lower-left corner.
You can change the action language of a chart in the Action Language box of the Chart properties dialog box.
For more information, see Differences Between MATLAB and C as Action Language Syntax.
To change the default action language of new charts, use these commands.
|sfpref('ActionLanguage','MATLAB')||All new charts created have MATLAB as the action language, unless otherwise specified in sfnew.|
|sfpref('ActionLanguage','C')||All new charts created have C as the action language, unless otherwise specified in sfnew.|
For more information, see sfnew.
For nonempty charts, after you change the action language property from C to MATLAB, a notification appears at the top of the chart. The notification provides the option to convert some of the C syntax to MATLAB syntax. In the notification, click the link to have Stateflow convert syntax in the chart. C syntax constructs that are converted include:
Binary and bit-wise operations
C style comments
Explicit casting for constant assignments
If the chart contains C constructs that cannot be converted to MATLAB, Stateflow shows a message in a dialog box. Click on the warnings link to display the warnings in the Diagnostic Viewer. Choose whether or not to continue with the conversion of supported syntax. C constructs not converted to MATLAB include:
Explicit type casts with cast and type
Operators such as &, * and :=
Access to workspace variables using ml operator
Functions not supported in code generation
Hexadecimal and single precision notation