Search & Replace Tool
Find and replace text in Stateflow charts
Description
Use the Search & Replace tool to find and modify text in your Stateflow® charts. Search an individual chart or all of the charts in a Simulink® model. Modify the scope of your search by enabling case-sensitive searching, matching only whole words, using regular expressions to define search patterns, or filtering by object and field types. Enable case-preserving replacements for lowercase, uppercase, title case, or sentence case text.
Open the Search & Replace Tool
Open a Stateflow chart. Then, in the Modeling tab, select Find > Find & Replace in Chart.
Examples
Parameters
Match case
— Case-sensitive searching
off
(default) | on
Select this parameter to enable case-sensitive searching.
When you select this parameter, the Search & Replace tool finds only text that exactly matches the text in the Search for field.
When you clear this parameter, the Search & Replace tool matches the character sequence in the Search for field, regardless of case. For example, the search text
"gear"
matches the text"gear"
,"Gear"
, or"GEAR"
.
Preserve case
— Case-preserving replacement
off
(default) | on
Select this parameter to enable case-preserving replacements. When you select this parameter, the Search & Replace tool replaces the matching text based on these conditions:
If the matching text has only lowercase characters, the Search & Replace tool replaces the matching text entirely with the lowercase equivalent of all replacement characters. For example, if the replacement text is
"AnDreW"
, the matching text"james"
is replaced by"andrew"
.If the matching text has only uppercase characters, the Search & Replace tool replaces the matching text entirely with the uppercase equivalent of all replacement characters. For example, if the replacement text is
"AnDreW"
, the matching text"JAMES"
is replaced by"ANDREW"
.If the matching text uses title case, with uppercase characters in the first character position of each word, the Search & Replace tool replaces the matching text with the replacement text in title case. For example, if the replacement text is
"AnDreW jAcksOn"
, the matching text"James Monroe"
is replaced by"Andrew Jackson"
.If the matching text uses sentence case, with an uppercase character in the first character position of a sentence and all other sentence characters in lowercase, the Search & Replace tool replaces the matching text with the replacement text in sentence case. For example, if the replacement text is
"AnDreW is TALL"
, the matching text"James is tall"
is replaced by"Andrew is tall"
.
If the matching text does not follow any of these patterns, the Search & Replace tool replaces the matching text using the exact case specified by the replacement text.
Search in
— Location to search
chart name (default) | model name
Specify the location to search. You can select an individual chart or all of the charts in a loaded Simulink model. By default, the Search & Replace tool searches only the chart in which you opened the tool.
Note
The left drop-down list shows the charts in only one model at a time. To select a Stateflow chart in a different model, first select the model. Then open the drop-down list a second time and select the chart.
Style
— Style of text for which to search
Contains word
(default) | Match whole word
| Regular expression
Use the drop-down list to the right of the Search in parameter to specify one of these options:
Contains word
— Search for text in any expression. For example, the search text"gear"
matches the text"gear_state"
.Match whole word
— Search for whole word expressions delimited by a blank space or a character that is not alphanumeric or an underscore character. For example, the search text"gear"
does not match the text"gear_state"
.Regular expression
— Treat the search text as a regular expression. For example,the search text"g\w*_"
matches any text that begins with the letterg
and ends with an underscore. For more information, see Regular Expressions.
Object types
— Type of objects in which to search
Machine
| Charts
| States
Junctions
| Transitions
| Data
| Events
| Messages
Specify the type of objects in which to search. You can limit your search to the Stateflow machine, charts, states, junctions, transitions, data, events, and messages. For more information, see Overview of Stateflow Objects.
Field types
— Type of fields in which to search
Names
| Labels
| Descriptions
| Document links
Specify the type of fields in which to search. You can limit your search to names, labels, descriptions, and document links.
Note
The Search & Replace tool looks for matching text anywhere in a state label regardless of whether you limit your search to names or labels.
Tips
The Search & Replace tool does not search the names of Simulink models and Stateflow charts. To change the names of models and charts, use the Simulink model window.