Stateflow    

Searching Charts

The Simulink Find dialog box allows you to search Stateflow models for Simulink and Stateflow objects, such as states and transitions, that meet criteria you specify. Simulink displays any objects that satisfy the search criteria in the dialog box's search results pane. To display the Find dialog box, select Find from the Stateflow Editor's Tools menu or from the Simulink model window's Edit menu. See Searching for Objects in the Simulink documentation for information on using the Find dialog box.

Stateflow Finder

The Finder operates on a machine. This is the Finder dialog box.

String Criteria

You specify the string by entering the text to search for in the Look for: text box. The search is case sensitive. All text fields are included in the search by default. Alternatively, you can search in specific text fields by using the drop down Look in: list box to choose one of these options:

Search Method

By default the Search Method is Normal/Wildcard (regular expression). Alternatively, you can click on the Exact Word match option if you are searching for a particular sequence of one or more words.

A regular expression is a string composed of letters, numbers, and special symbols that defines one or more strings. Some characters have special meaning when used in a regular expression while other characters are interpreted as themselves. Any other character appearing in a regular expression is ordinary, unless a \ precedes it.

These are the special characters supported by Stateflow.

Character
Description
^
Start of string
$
End of string
.
Any character
\
Quote the next character
*
Match zero or more
+
Match one or more
[ ]
Set of characters

Object Type

Specify the object type(s) to search by toggling the radio boxes. A check mark indicates that the object is included in the search criteria. By default, all object types are included in the search criteria. Object Types include:

Find Button

Click on the Find button to initiate the search operation. The data dictionary is queried and the results are listed in the display area.

Matches

The Matches field displays the number of objects that match the specified search criteria.

Refine Button

After the results of a search are displayed, enter additional search criteria and click on the Refine button to narrow the previously entered search criteria. An ampersand(&) is prepended to the search criteria in the Search History: field to indicate a logical AND with any previously specified search criteria.

Search History

The Search History text box displays the current search criteria. Click on the pull-down list to display search refinements. An ampersand is prepended to the search criteria to indicate a logical AND with any previously specified search criteria. You can undo a previously specified search refinement by selecting a previous entry in the search history. By changing the Search History selection you force the Finder to use the specified criteria, as the current, most refined, search output.

Clear Button

Click the Clear button to clear any previously specified search criteria. Results are removed and the search criteria is reset to the default settings.

Close Button

Click the Close button to close the Finder.

Help Button

Click the Help button to display the Stateflow online help in an HTML browser window.

Finder Display Area

The Finder display area looks like this.

The display area is divided into these fields.

Field
Description
Type
The object type is listed in this field. States with exclusive (OR) decomposition are followed by an (O). States with parallel (AND) decomposition are followed by (A).
Label

The string label of the object is listed in this field.

Chart

The title of the Stateflow diagram (Stateflow block) is listed in this field.

Parent
This object's parent in the hierarchy.
Source
Source object of a transition.
Destination
Destination object of a transition.

All fields are truncated to maintain column widths. The Parent, Source, and Destination fields are truncated from the left so that the name at the end of the hierarchy is readable. The entire field contents, including the truncated portion, is used for resorting.

Each field label is also a button. Click on the button to have the list sorted based on that field. If the same button is pressed twice in a row, the sort ordering is reversed.

The Finder can be resized vertically to display more output rows, but cannot be expanded horizontally.

Click on a graphical entry to highlight that object in the graphical editor window. Double-click on an entry to invoke the Property dialog box for that object. Right-click the entry to display a pop-up menu that allows you to explore, edit, or display the properties of that entry.

Representing Hierarchy

The Finder displays Parent, Source, and Destination fields to represent the hierarchy. The Stateflow diagram is the root of the hierarchy and is represented by the / character. Each level in the hierarchy is delimited by a . character. The Source and Destination fields use the combination of the ~ and the . characters to denote that the state listed is relative to the Parent hierarchy.

Using this Stateflow diagram as an example,

what are the values for the Parent, Source, and Destination fields for the transition from A2a to A2b?

The transition is within state A2. State A2's parent is state A and state A's parent is the Stateflow diagram itself. /A.A2 is the notation for state A2a's parent. State A2a is the transition source and state A2b is the destination. These states are at the same level in the hierarchy. ~.A2a is the relative hierarchy notation for the source of the transition. The full path is /A.A2.A2a. The relative hierarchy notation for the destination of the transition is ~.A2b. The full path is /A.A2.A2b.


 Exploring Charts Notations