Differences Between MATLAB and C as Action Language Syntax

FunctionalityMATLAB as the Action LanguageC as the Action Language

MATLAB® syntax in states and transitions

Supported

Not supported

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

Supported

Not supported

Control flow logic in state labels

Supported

Not supported

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

Supported

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.

Supported

Array indexing

One-based indexing

Zero-based indexing

Fixed-point constructs:

  • Assignment operator :=

  • Context-sensitive constants, such as 3C

Not supported

Supported

Use of custom code variables in states and transitions

Not supported

Supported

Use of custom code functions in states and transitions

Supported

Supported

Identifiers for enumerated values without a type prefix

Not supported

Supported

Interpretation of state actions without a label as entry actions

Automatic correction

Supported

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

Initial value specification for outputs and local data

Not available in data properties

Implicit 0

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

Not available

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

Supported

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?