As you build and modify your model, it helps when you can understand your model structure and locate specific model elements. Simulink® Editor tools simplify these tasks. Use the tool that is appropriate for your model size and complexity.
Use the model browser to view and navigate the structure of your model. You can find an element using the model browser by navigating to it through the model hierarchy. This approach works well for a small model whose structure you are familiar with. See Explore the Model Hierarchy Using the Model Browser.
On the Modeling tab, click Find to locate model elements that match search criteria. You can search in a selected system and optionally include all systems below it. You can also narrow your results based on search criteria. See Search for Model Elements Using Find.
Use the Model Explorer to search the model hierarchy using advanced criteria. You can use it to search the model hierarchy and search for variables. The Model Explorer also enables you to search in and apply a change to multiple model elements at once. See Search Using Model Explorer.
Use project-wide search to search across all your models and supporting files in one place. You can find matches inside model files, MATLAB® files, and other project files such as PDF and Microsoft® Word files. See Project-Wide Search.
Use the model browser to navigate a model hierarchy using a tree structure. The browser helps you to understand the organization of your model and explore systems within systems.
To display the Model Browser, in the Simulink Editor, in the Modeling tab, select Environment > Model Browser. You can toggle the Model Browser display by clicking the
Hide/Show Model Browser control .
In the Model Browser, specify whether to include blocks that are linked to a
library or masked subsystems. Click and select Library
Links or Systems with Mask Parameters.
For information on these types of blocks, see Linked Blocks and Masking Fundamentals.
You can search in Simulink models by clicking Find on the Modeling tab. Use Find to locate, navigate to, and select any element that matches the search string that you enter. Searching can match the string anywhere in the element, such as in the name and in parameter values. You can customize the search to look only in certain types of elements or when specific parameters are set a certain way.
Default Search | Search Options |
---|---|
In the current system | Specify to search the current system and all systems below it in the model hierarchy. |
In all model elements, including all types of Simulink and Stateflow® objects | Narrow your search to include only the elements you are interested in, such as blocks, annotations, or signals. |
In parameters | Specify to omit parameter values from the search. |
Case-insensitive, partial matches | Search for an exact match and use regular expressions. |
In referenced models but not in linked blocks or masked systems | You can turn each of these options off and on. |
Search in the current level of the model sldemo_fuelsys
for
any model element that contains the number 2
.
Open the Property Inspector to see the properties and parameters of the current selection. In the Modeling tab, under Design, click Property Inspector.
Open the model sldemo_fuelsys
.
On the Modeling tab, click Find.
In the search box, enter 2
and press Enter.
Nine model elements appear highlighted. The first element found, the copyright annotation, has a stronger highlight to show that it is the current match.
To move to the next element, click the search box down arrow. In this example, the current selection highlight moves to a Constant block. The block name does not appear in the model. Look in the Property Inspector to see the block name, Constant2.
Use the up and down arrows to move through the rest of the elements found.
You can narrow your search by specifying search criteria. For an example, see Specify Search Criteria and Sort Results.
On the Modeling tab, click Find.
Enter the search string. Alternatively, you can add the search string later.
Click View Details.
Click the Configure advanced search settings
button .
In the Advanced Search Settings dialog box, for each criterion you
want to set, click the Add property and value
button . Select the property and enter the
value for each criterion.
Set any other advanced search settings, and then click OK.
If you entered a search string, the search executes. Alternatively,
you can enter the search string after you specify the criteria, or enter
an asterisk (*
) to search for any model element that
matches the advanced criteria.
You can cancel a search and view partial search results. In the Finder interface, click the Stop Search button.
Using the search box, you can specify a property and value to search for. Enter the search
string in the form Property:Value
. For example, to search
for all Constant value parameters whose value is
throttle_sw
, type Value:throttle_sw
and press Enter. To search for all Constant blocks, enter
BlockType:Constant
. To search for text that appears in
the description of the block, use the form
Description:textstring
.
Search using the programmatic name of the property. To find the programmatic name, in the Property Inspector, hover over the property.
Enter the full property name, case insensitive. You cannot use regular expressions or partial matches for the property name.
By default, the value search is case insensitive and finds partial matches. Use the advanced search settings to make the search case sensitive, specify verbatim matches, or search using regular expressions.
To search for a string that has a colon and prevent the text before the colon from being treated as a property, use one of these approaches:
Escape the colon using a backslash, for example, Earth\:
a planet
.
Use single or double quotes around the expression, for example,
'Earth: a planet'
or "Earth: a
planet"
.
You can specify criteria for your search and sort the results using the Finder
interface. In this example, you search for all elements that contain the string
fuel
. You then use the Finder interface to narrow your
results. You can interact with search results while the search runs. However,
you can sort the results only after the search is complete.
Use the model browser with the Finder interface to select the starting point for your search.
Open the model sldemo_fuelsys
.
On the Modeling tab, click Find. Next to the search box, click View Details.
To expand the scope of the search, in the Finder interface, click the
Click to search in current system and below
button .
Search for any elements that include the string
fuel
. In the search box, enter
fuel
and press Enter.
The model has many elements with fuel
in the name
or in a parameter or property value, including blocks, annotations,
signals (data), and Stateflow charts.
Use the Finder interface to make your results more meaningful. For example, you can sort by any of the headings and double-click an item in the list to go to and select the element in the model. Click an item in the list to make it the current match in the model if it is displayed.
When a search returns too many results, use the advanced search
settings. Next to the search box, click the Configure
advanced search settings button .
Search only for blocks. In the Advanced Search Settings dialog box, under Object Type, clear the Stateflow check box. Expand the Simulink list and clear the Annotations and Signals check boxes.
Narrow the search further to look only in blocks whose description
contains the word input
. Under Property :
Value, from the property list, select
BlockDescription
. In the value box, enter
input
, and then click the Add property
and value button . Click
OK.
Searching returns fewer blocks. You can add more property values to
narrow the search further. For example, you can specify the type of
blocks to search in. Open the Advanced Search Settings dialog box. Under
Property : Value, add another
property-value pair. Set the property to BlockType
and the value to MultiPortSwitch
. Click the
Add property and value button and click
OK.
One block appears in the list.
Clear the advanced search criteria. Click the arrow on the Configure advanced search settings button and select Clear advanced settings.
Model Explorer helps you to explore and modify your model using advanced techniques. Use the Model Explorer for to search for:
Variables in workspaces and data dictionaries
Variable usage in a model
Instances of a type of block
Block parameters and parameter values
You can combine search criteria and iteratively refine the results. Search in Model Explorer for model elements, starting with the node you select in the model hierarchy. You can search the entire model, in a particular system, or in a system and all the systems below it in the hierarchy. For details on the options, see Search Bar Controls.
Using your search results, you can apply changes to multiple elements at once.
To modify algorithmic block parameters such as the Gain parameter of a Gain block, consider using the Model Data Editor. See Configure Data Properties by Using the Model Data Editor.
In this example, you search for model elements that have an Integer rounding mode parameter. You then refine the results to include only n-D Lookup table blocks. You can use the search results to find out more about how these values are set or make batch changes to the model elements found by the search.
Open the model sldemo_fuelsys
.
Open Model Explorer. On the Modeling tab, click Model Explorer.
By default, the Model Explorer searches the current system and below.
You can use the model hierarchy tree in combination with the
Show contents button to specify the scope of the search.
For example, you can select a node and set the search to
current system only to keep the search only at
that level. Set the search to current system and
below to search the current system and all the subsystems
within it.
For this example, leave the search scope set to search the current system and below, starting with the top level of the model. Specify your search criteria. In the search bar, set:
Search to by Property
Name
Property to
Rounding
Rounding
is the programmatic name for
the Integer rounding mode parameter.
For a list of these names, see Block-Specific Parameters.
Click Search. In the Search Results box, 43 results appear. You can go to an item by clicking the link to the path.
Refine the search. In the search bar, click Search Options and select Refine Search.
The search button label changes to Refine. With this label in effect, additional search criteria act on the previous set of results.
Set Search to by Block
Type
and set Type to
Lookup_n-D
. Click Refine.
The search returns 5 items.
To work further with the values, click Show Details.
The property you are interested in learning more about or acting on is
Rounding
. First add a column for it in the search
results. Select Rounding
from the list (you can enter
it in the Find Properties box to locate it
quickly), and click the Display property as column in
view button.
A column for Rounding
appears in the search results. For any parameter or
property that appears in a column, you can view, sort, and change values for
multiple items. For example, to change the Rounding
values on
all n-D Lookup Table blocks you find by searching, select all the
items in the list. In the Rounding column, click one cell
and select a new value from the list (for example,
Floor
).
To view a summary of the search options that you used, expand
the Number of objects found box by clicking the Show
Search Details button .
To create, modify, and view the entries in a data dictionary, use the Model Explorer. See Edit and Manage Workspace Variables by Using Model Explorer and View and Revert Changes to Dictionary Data.
For general information about Model Explorer and its uses, see Search and Edit Using Model Explorer.