Model Explorer: Model Hierarchy Pane

What You Can Do with the Model Hierarchy Pane

The Model Hierarchy pane displays a tree-structured view of the Simulink® model and Stateflow® chart hierarchy. Use the Model Hierarchy pane to navigate to the part of the model and chart hierarchy that you want to explore.

Simulink Root

The first node in the hierarchy represents the Simulink root. Expand the root node to display nodes representing the MATLAB® workspace, Simulink models, and Stateflow charts that are in the current session.

Base Workspace

This node represents the MATLAB workspace. The MATLAB workspace is the base workspace for Simulink models and Stateflow charts. Variables defined in this workspace are visible to all open models and charts.

For information about exporting and importing workspace variables, see Export Workspace Variables and Importing Workspace Variables.

Configuration Preferences

To display a Configuration Preferences node in the expanded Simulink Root node, enable the View > Show Configuration Preferences option. Selecting this node displays the preferred configuration for new models (see Manage a Configuration Set). You can change the preferred configuration by editing the displayed settings and using the Model Configuration Preferences dialog box to save the settings (see Model Configuration Preferences).

Model Nodes

Expanding a model or chart node in the Model Hierarchy pane displays nodes representing the following elements, as applicable for the models and charts you have open.

NodeDescription

Model workspace

For information about how to use the Model Explorer to work with model workspace variables, see the following sections:

Configuration sets

For information about adding, deleting, saving, and moving configuration sets, see Manage a Configuration Set.

Top-level subsystems

Expand a node representing a subsystem to display underlying subsystems, if any.

Model blocks

Expand model blocks to show contents of referenced models (see Expanding Model References).

Stateflow charts

  • Expand a node representing a Stateflow chart to display the top-level states of the chart.

  • Expand a node representing a state to display its substates.

Displaying Partial or Whole Model Hierarchy Contents

By default, the Model Explorer displays objects for the system that you select in the Model Hierarchy pane. It does not display data for child systems. You can override that default, so that the Model Explorer displays objects for the whole hierarchy of the currently selected system. To toggle between displaying only the current system and displaying the whole system hierarchy of the current system, use one of these techniques:

  • Select View > Show Current System and Below.

  • Click the Show Current System and Below button ( ) at the top of the Contents pane.

When you select the Show Current System and Below option:

  • The Model Hierarchy pane highlights in pale blue the current system and its child systems.

  • After the path in the Contents of field, the text (and below) appears.

  • The appearance of the Show Current System and Below button at the top of the Contents pane and in the View menu changes.

  • The status bar indicates the scope of the displayed objects when you hover over the Show Current System and Below button.

Loading very large models for the current system and below can be slow. To stop the loading process at any time, either click the Show Current System and Below button or click another node in the tree hierarchy.

If you show the current system and below, you might want to change the view to better reflect the displayed system contents. For details about views, see Control Model Explorer Contents Using Views.

The setting for the Show Current System and Below option is persistent across Simulink sessions.

Displaying Linked Library Subsystems

By default, the Model Explorer does not display the contents of linked library subsystems in the Model Hierarchy pane. To display the contents of linked library subsystems, use one of these approaches:

  • At the top of the Model Hierarchy pane, click the Show/Hide Library Links button ( ).

  • From the View menu, select Show Library Links.

Library-linked subsystems are visible in the Contents pane, regardless of how you configure the Model Hierarchy pane.

    Note:   Search does not find elements in linked library or masked subsystems that are not displayed in the Model Hierarchy pane.

Displaying Masked Subsystems

By default, the Model Explorer does not display the contents of masked subsystems in the Model Hierarchy pane. To display the contents of masked subsystems, use one of these approaches:

  • At the top of the Model Hierarchy pane, click the Show/Hide Masked Subsystems button ( ) .

  • From the View menu, select Show Masked Subsystems.

Masked subsystems are visible in the Contents pane, regardless of how you configure the Model Hierarchy pane.

Linked Library and Masked Subsystems

For subsystems that are both library-linked and masked, how you set the linked library subsystems and masked subsystems options affects which subsystems appear in the Model Hierarchy pane, as described in the following table.

SettingsSubsystems Displayed in the Model Hierarchy Pane

Show Library Links

Hide Masked Subsystems

Only library-linked, unmasked subsystems

Hide Library Links

Show Masked Subsystems

Only masked subsystems that are not library-linked subsystems

Show Library Links

Show Masked Subsystems

All library-linked or masked subsystems

Displaying Node Contents

Select the object in the Model Hierarchy pane whose contents you want to display in the Contents pane.

Navigating to the Block Diagram

To open a graphical object (for example, a model, subsystem, or chart) in an editor window, right-click the object in the Model Hierarchy pane. From the context menu, select Open.

Working with Configuration Sets

See Manage a Configuration Set for information about using the Model Hierarchy pane to perform tasks such as adding, deleting, saving, and moving configuration sets.

Expanding Model References

To browse a model that includes Model blocks, you can expand the Model Hierarchy pane nodes of the Model blocks. For example, the sldemo_mdlref_depgraphsldemo_mdlref_depgraph model includes Model blocks that reference other models. If you open the sldemo_mdlref_depgraph model and expand that model node in the Model Hierarchy pane, you see that the model contains several Model blocks, including heat2cost.

To browse a model referenced by a Model block:

  1. Right-click the referenced model node in the Model Hierarchy pane.

  2. From the context menu, choose Open Model.

    • The referenced model opens.

    • The Model Hierarchy pane indicates that you can expand the Model block node.

    • The Model Hierarchy pane displays a separate expandable node for the referenced model (read-only).

    • The Contents pane displays objects corresponding to the Model block node (read-only).

For example, if you right-click the heat2cost Model block node and select the Open Model option, the Contents pane displays the objects corresponding to the heat2cost Model block. You can expand the heat2cost node.

You can browse the contents of the referenced model, but you cannot edit the model objects that are underneath the Model block.

Editing the Referenced Model

To edit the referenced model, expand the referenced model node in the Model Hierarchy pane. For example, expand the sldemo_mdlref_heat2cost node:

You can now edit the properties of object in the referenced model.

For information about referenced models, see Model Reference.

Cutting, Copying, and Pasting Objects

To cut, copy, and paste workspace objects from one workspace into another workspace:

  1. In the Contents pane, right-click on the workspace object you want to cut or copy.

  2. From the context menu, select Cut or Copy.

    • You can also cut a workspace object by selecting in the Contents pane Edit > Cut or by clicking the Cut button ( ).

    • You can also copy a workspace object by selecting Edit > Copy or by clicking the Copy button ( ).

  3. If you want to paste the workspace object that you cut or copied, in the Model Hierarchy pane, right-click the workspace into which you want to paste the object, and select Paste.

    • You can also paste the object by selecting Edit > Paste or by clicking the Paste button ( ).

You can also perform cut, copy, and paste operations by selecting an object and performing drag and drop operations.

Was this topic helpful?