Products & Services Solutions Academia Support User Community Company

Examples


Use this list to find examples in the documentation.

Stateflow Chart Objects

Stateflow Chart Objects
States
Transitions
Default Transitions
Conditions
History Junction
Actions
Connective Junctions

Stateflow Hierarchy

Stateflow Hierarchy of Objects
Representing State Hierarchy Example
Transition Hierarchy

Active and Inactive States

Exclusive (OR) State Decomposition
Parallel (AND) State Decomposition

Label Notation

Transition Label Example

Transition Connections

Transitions to and from Exclusive (OR) States
Transitions to and from Junctions
Transitions to and from Exclusive (OR) Superstates
Transitions to and from Substates
Self-Loop Transitions

Inner Transitions

Before Using an Inner Transition
After Using an Inner Transition to a Connective Junction
Using an Inner Transition to a History Junction
Processing One Event in an Exclusive (OR) State
Processing a Second Event in an Exclusive (OR) State
Processing a Third Event in an Exclusive (OR) State
Processing the First Event with an Inner Transition to a Connective Junction
Processing a Second Event with an Inner Transition to a Connective Junction
Inner Transition to a History Junction Example

Default Transitions

Default Transition to a Junction Example
Default Transition with a Label Example
Default Transition in Exclusive (OR) Decomposition Example
Default Transition to a Junction Example
Default Transition and a History Junction Example
Labeled Default Transitions Example

Connective Junctions

Connective Junction with All Conditions Specified Example
Connective Junction with One Unconditional Transition Example
Connective Junction — Self-Loop Example
Connective Junction and For Loops Example
Flow Graph Notation Example
Connective Junction from a Common Source to Multiple Destinations Example
Connective Junction Common Events Example
Label Format for Transition Segments Example
If-Then-Else Decision Construct Example
Self-Loop Transition Example
For-Loop Construct Example
Flow Graph Notation Example
Transitions from a Common Source to Multiple Destinations Example
Transitions from Multiple Sources to a Common Destination Example
Transitions from a Source to a Destination Based on a Common Event Example
Backtracking Behavior in Flow Graphs Example

History Junctions

Use of History Junctions Example

Graphical Functions

Graphical Functions
Creating a Graphical Function
Calling Graphical Functions in Stateflow Action Language
Exporting Chart-Level Graphical Functions
Specifying Graphical Function Properties

Boxes

Boxes
Drawing and Editing a Box
Deleting a Box
Changing a State to a Box
Using a Box to Group Functions
Using a Box to Group States

Early Return Logic for Event Broadcasts

Early Return Logic for Event Broadcasts

Charts

Creating a Stateflow Chart

Self-Loop Transitions

Creating Self-Loop Transitions

Stateflow Editor Window

Stateflow Editor Window

Mealy and Moore Charts

Creating Mealy and Moore Charts
Mealy Vending Machine
Moore Traffic Light

Supertransition

What Is a Supertransition?
Drawing a Supertransition Into a Subchart
Drawing a Supertransition Out of a Subchart

Smart and Nonsmart Transitions

Smart Transitions Slide Around Surfaces
Smart Transitions Slide and Maintain Shape
Smart Transitions Connect States to Junctions at 90 Degree Angles
Smart Transitions Snap to an Invisible Grid
Smart Transitions Bow Symmetrically
Smart Transitions Prefer Straight Lines from Junctions
Nonsmart Transitions Anchor Connection Points
Nonsmart Transitions Distort Asymmetrically

Note Font and Color

TeX Instructions

Data and Events

Sharing Input and Output Data with Simulink Models
Example of Using an Edge-Triggered Output Event
Example of Queuing Behavior for Edge-Triggered Output Events
Example of Using Queuing Behavior to Approximate a Function Call
Example of Using a Function-Call Output Event
Example of Interleaving Behavior for Function-Call Output Events
Using Data and Event Arguments in Actions
Example of Directed Event Broadcasting Using send
Example of Directed Event Broadcasting Using Qualified Event Names
Symbol Autocreation Wizard

Action Language

State Action Types

Custom C Code Functions

Function Call Transition Action Example
Function Call State Action Example

MATLAB Functions and Variables

ml Namespace Operator
ml Function
ml Expressions
Which ml Should I Use?
ml Data Type
How Charts Infer the Return Size for ml Expressions

Temporal Logic Operators

Rules for Using Temporal Logic Operators
Operators for Event-Based Temporal Logic
Examples of Event-Based Temporal Logic
Operators for Absolute-Time Temporal Logic
Examples of Absolute-Time Temporal Logic
Running a Model That Demonstrates Absolute-Time Temporal Logic

Change Detection

Running a Model That Demonstrates Change Detection
Change Detection Operators
Change Detection Example

Checking State Activity

The in Operator
State Resolution for Identically Named Substates
Best Practices for Checking State Activity

Simulation State of a Chart

Example of Dividing a Long Simulation into Segments
Example of Testing a Unique Chart Configuration
Example of Testing a Chart with Fault Detection Logic

Continuous-Time Modeling

Running Models That Demonstrate Continuous-Time Modeling
Modeling a Bouncing Ball in Continuous-Time

Fixed-Point Data

Fixed-Point "Bang-Bang Control" Example
Example of Using the := Operator for Addition and Subtraction
Example of Using the := Operator for Multiplication
Example of Using the := Operator for Division
Offline and Online Conversion Examples

Complex Data

Implementing a Frame Synchronization Controller Using a Stateflow Chart
Implementing a Spectrum Analyzer Using a Stateflow Chart

Interfaces with Simulink Models

Triggered Stateflow Block Example
Sampled Stateflow Block Example
Inherited Stateflow Block Example
Function-Call Output Events Example
Function-Call Semantics Example
Edge-Triggered Semantics Example

Structures and Buses

Example of Stateflow Structures
Indexing Sub-Structures and Fields
Integrating Custom Structures in Stateflow Charts

Stateflow Design Patterns

Debouncing Signals
Scheduling Execution of Simulink Subsystems
Implementing Dynamic Test Vectors

Truth Table Functions

Creating a Stateflow Truth Table
Calling a Truth Table in a Stateflow Action
Creating Truth Table Data in Stateflow Charts and Simulink Models
Programming a Truth Table

Embedded MATLAB Functions

Building a Simulink Model with an Embedded MATLAB Function
Programming an Embedded MATLAB Function
Debugging an Embedded MATLAB Function

Simulink Functions in Stateflow Charts

Example of Defining a Function That Uses Simulink Blocks
Example of Scheduling Execution of Multiple Controllers

Parsing Stateflow Charts

Parsing Chart Example

Debugging

Example of Debugging Run-Time Errors in a Chart
State Inconsistency Example
Example of Conflicting Transitions
Data Range Violation Example
Cyclic Behavior Example
Flow Cyclic Behavior Not Detected Example
Noncyclic Behavior Flagged as a Cyclic Example

Signal Logging

Setting Test Points for Stateflow States and Local Data with the Model Explorer
Logging Chart Signals Using the Signal Logging Dialog Box
Logging Chart Signals Using the Command-Line API
Using a Floating Scope to Monitor Data Values and State Activity

Model Coverage

Superstate Containing Exclusive OR Substates Decision
Condition Coverage
MCDC Coverage
Summary Report Section
Chart as Subsystem Details Report Section
Chart as Superstate Details Report Section
State Details Report Section
Transition Details Report Section

Search and Replace

Searching with Regular Expression Tokens
Replacing with Case Preservation
Replacing with Tokens

Stateflow Finder

Representing Hierarchy

Transitions to and from Exclusive (OR) States

Transitioning from State to State with Events Example
Transitioning from a Substate to a Substate with Events Example

Condition Actions

Condition Action Example
Condition and Transition Actions Example
Condition Actions in For-Loop Construct Example
Condition Actions to Broadcast Events to Parallel (AND) States Example
Cyclic Behavior to Avoid with Condition Actions Example

Event Actions

Event Actions in a Superstate Example

Parallel (AND) States

Event Broadcast State Action Example
Event Broadcast Transition Action with a Nested Event Broadcast Example
Event Broadcast Condition Action Example

Directed Event Broadcasting

Directed Event Broadcast Using Send Example
Directed Event Broadcast Using Qualified Event Name Example

Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS