Main Content

Finder

Find and optionally replace values in Simulink models, libraries, and subsystems

Description

Use the Finder to search for Simulink® models, libraries, and subsystems for elements that contain the search string that you enter.

The search can match the string anywhere in the element, such as in the name or in the parameter values. You can customize the search to look only in certain types of elements or for elements with specific parameter settings.

From the search results, you can select and navigate to elements. You can also replace found instances of the search string with another string.

By default, the Finder searches all model elements in the current system, its referenced models, its linked blocks, and its masked systems for case-insensitive partial or full matches.

Finder

Open the Finder

  • In the Simulink Toolstrip, on the Modeling tab, click Find.

  • In the Simulink quick access toolbar, click Find .

    If Find is not in the quick access toolbar, click Common Controls and select Find.

  • With the Simulink Editor selected, press Ctrl+F.

Examples

expand all

In this example, you search the top level of the sldemo_fuelsys model for any model element that contains the number 2.

  1. Open the Model Fault-Tolerant Fuel Control System example model sldemo_fuelsys.

    openExample("simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample",...
        SupportingFile="sldemo_fuelsys")

  2. Open the Finder. On the Modeling tab, click Find.

  3. Click the Change the search scope button arrow and select Search this level only.

  4. In the search box, enter 2.

    Model elements that contain the search string appear in a table. The first element in the table is selected.

  5. To move to the next element, click the down arrow Arrow to the right of the search bar.

  6. Use the up and down arrows to move through the rest of the found elements. Alternatively, scroll through the table and click an element to select it.

When a search returns too many results, use the advanced search settings to narrow your search.

The advanced search settings allow you to:

  • Include only the elements you are interested in, such as blocks, annotations, or signals.

  • Omit block parameter values from the search.

  • Search for case-sensitive matches.

  • Search for exact matches.

  • Search using regular expressions.

  • Omit masked systems, linked blocks, and referenced models from the search.

  • Search based on property values such as BlockDescription or BlockType.

In this example, you search the sldemo_fuelsys model for all elements that contain the string speed. You then use the Advanced settings pane to refine your results.

  1. Open the Model Fault-Tolerant Fuel Control System example model sldemo_fuelsys.

    openExample("simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample",...
        SupportingFile="sldemo_fuelsys")

  2. Open the Finder. On the Modeling tab, click Find.

  3. Enter the search string. For example, enter speed.

    Model elements that contain the search string appear in a table. The first element in the table is selected.

    Alternatively, you can enter the search string after you specify the search settings

  4. Click Advanced settings .

    The Advanced Settings pane opens.

    The Advanced Settings pane appears with options to specify object types, search criteria, what to look inside, and property values.

  5. Specify the advanced settings you want. For example, in the Property : Value section, change BlockDescription to BlockType. In the corresponding text box, type Constant and click Add property and value .

    Note

    In the Property : Value section, if you want to search based on a property that is not in the list, select Other, then enter the full programmatic name of the property. To find the programmatic name, in the Property Inspector, pause on the property. You cannot use regular expressions or partial matches for the property name.

  6. Click Find to find results that match the updated search criteria.

To restore the default advanced settings, click Reset.

You can find and replace text using the Finder.

For search results to support replacement:

  • You must have write access for the field.

  • The field value must be the same as when you performed the search.

  • The text formatting must be plain.

In this example, you search the sldemo_fuelsys model for the string rad and replace rad with deg.

  1. Open the Model Fault-Tolerant Fuel Control System example model sldemo_fuelsys.

    openExample("simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample",...
        SupportingFile="sldemo_fuelsys")

  2. Open the Finder. On the Modeling tab, click Find.

  3. In the search box, enter the search string. For example, enter rad.

    Model elements that contain the search string appear in a table.

  4. To the left of the search box, click the Find button arrow, and select Replace.

    Replace options appear in the Finder.

  5. In the text box next to the Replace button, enter the replacement string. For example, enter deg.

  6. Select the instance you want to replace, then click Replace.

    The Finder shows four results for "rad" in the sldemo_fuelsys model hierarchy. The first result has "rad" replaced with "deg," and the second result is selected.

    Alternatively, replace all instances of the found string by clicking Replace > Replace All.

    Note

    If you stop the replacement operation before it completes, the completed replacements do not revert.

  7. To view a replacement in the model, double-click the row that corresponds to the replaced element.

If you want to revert replacements, you must revert them before you perform another search or close the Finder. To revert replacements, select the instance to revert, then click Revert. Alternatively, click the Revert button arrow and select Revert All. The Finder applies the inverse replacements to restore the original values.

Related Examples

Limitations

You cannot use the Finder to replace code in a Test Sequence block.

Tips

  • To select the starting point for your search, use the Model Browser.

  • To go to and select the element in the model, double-click an item in the list.

  • To search for any model elements that match the search criteria, enter an asterisk (*) in the search box.

  • To search for a string that contains a colon, escape the colon using a backslash (for example, Earth\: a planet), or use single or double quotes around the expression (for example, 'Earth: a planet' or "Earth: a planet").

  • You can interact with search results while the search runs. However, you can sort the results only after the search is complete.

  • To stop a search and view partial search results, in the Finder, click the Stop button.

  • For table display options, pause on the Name heading and click the arrow that appears. The menu provides options to expand, collapse, and sort results. To sort the table based on another column, pause on the corresponding table heading and click the arrow that appears.

Version History

Introduced in R2016b