Rules for Naming Stateflow Objects

You can name Stateflow® objects with any combination of alphanumeric and underscore characters. Names cannot begin with a numeric character or contain embedded spaces.

Restriction on Name Length

Name length should comply with the maximum identifier length enforced by Simulink® Coder™ software. You can set the Maximum identifier length parameter. The default is 31 characters and the maximum length you can specify is 256 characters.

Keywords to Avoid When Naming Stateflow Objects

You cannot use reserved keywords to name Stateflow objects. These keywords are part of the action language syntax.

Usage in Action Language SyntaxKeywordsSyntax References
Boolean symbols
  • true

  • false

Boolean Symbols, true and false
Change detection
  • hasChanged

  • hasChangedFrom

  • hasChangedTo

Detect Changes in Data Values
Complex data
  • complex

  • imag

  • real

Supported Operations for Complex Data
Data types
  • boolean

  • double

  • int64 (C charts only)

  • int32

  • int16

  • int8

  • single

  • uint64 (C charts only)

  • uint32

  • uint16

  • uint8

Specify Type of Stateflow Data
Data type operations
  • cast

  • fixdt

  • type

Type Cast Operations
Explicit events
  • send

Broadcast Local Events to Synchronize Parallel States
Implicit events
  • change

  • chg

  • tick

Define Chart Behavior by Using Implicit Events
  • send

  • forward

  • discard

  • isvalid

  • length

  • receive

Communicate with Stateflow Charts by Sending Messages
Literal symbols
  • inf

  • t

Supported Symbols in Actions
  • this (standalone charts only)

Debug a Standalone Stateflow Chart
MATLAB® functions and data
  • matlab

  • ml (C charts only)

Access MATLAB Functions and Workspace Data in C Charts
State actions
  • bind

  • du

  • during

  • en

  • entry

  • ex

  • exit

  • on

State Action Types
State activity
  • in

Check State Activity by Using the in Operator
Temporal logic
  • after

  • at

  • before

  • count

  • duration

  • elapsed

  • every

  • msec

  • usec

  • sec

  • t

  • temporalCount

Control Chart Execution by Using Temporal Logic


Do not use the file names sf.sfx for Stateflow charts or sf.slx for Simulink models. Using these file names can shadow Stateflow program files and result in unpredictable behavior.

Related Topics