Differences Between MATLAB and C as Action Language Syntax

FunctionalityMATLAB as the Action LanguageC as the Action Language

MATLAB® syntax in states and transitions


Not supported

Automatic inference of scope, size, type, and complexity for unresolved input, output, and local data


Not supported

Control flow logic in state labels


Not supported

Dot notation for specifying states, local data, message, and local events inside MATLAB functions


Not supported

C constructs, such as:

  • Increment and decrement operations a++ and a--

  • Assignment operations a+=expr, a–=expr, a*=expr, and a/=expr

  • Evaluation operationsa != expr and !a

Automatic correction for operators to MATLAB syntax. For example, a++ is automatically corrected to a=a+1.


Array indexing

One-based indexing

Zero-based indexing

Fixed-point constructs:

  • Assignment operator :=

  • Context-sensitive constants, such as 3C

Not supported


Use of custom code variables in states and transitions

Not supported


Use of custom code functions in states and transitions



Interpretation of state actions without a label as entry actions

Automatic correction


Format of transition actions

Automatic correction

Not required to enclose a transition action with braces {}

Format of transition conditions

Automatic correction

Required to enclose a transition condition with brackets []

Type cast operations

Use MATLAB form

Use type operator

Explicit cast required in some situations

y = uint8(0)

y = 0

Structure parameters

Both tunable and nontunable

Tunable only

Specification of First index, Units, and Save final value to base workspace for data of any scope

Not available


Intermediate data type for arithmetic operations

Follows MATLAB typing rules

Follows C typing rules

Typing rules for addition

Data of type double added to data of any other type results in data of the non-double type.

Data of type double added to data of any other type results in data of type double.

Use of global fimath object


Not supported

Simulation time for the chart

Use the function getSimulationTime()

Represented by the symbol t

Ordering of parallel states

Explicit ordering

Explicit or implicit ordering

Data scopes in functions

Constant, Parameter, Input, OutputLocal, Constant, Parameter, Input, Output, Temporary

Was this topic helpful?