Main Content

Reference Existing Models

A model becomes a referenced model when a Model block in another model references it. Any model can function as a referenced model and can continue to function as a separate model.

To reference an existing model in another model:

  1. If the folder that contains the model you want to reference is not on the MATLAB® path, add the folder to the MATLAB path. For more information, see What Is the MATLAB Search Path?

  2. If you plan to reference the model once at most in a model hierarchy, in the configuration set of the referenced model, set Total number of instances allowed per top model to One. Otherwise, use the default value Multiple, which lets you reference the model more than once in a model hierarchy.

  3. To reference another model, add a Model block. The new block is initially unresolved because it does not specify a model to reference.

    An unresolved Model block with red corners and text that says, "Unspecified Model Name"

  4. To open the Block Parameters dialog box, double-click the unresolved Model block.

    Block Parameters dialog box for Model block.

  5. In the Model name text box, enter the name of the model you want to reference. The name must contain fewer than 60 characters, exclusive of the file extension.

  6. Click OK.

Connect Model Block Ports

The Model block displays a port for each root-level input and output port of the referenced model. When you connect a signal to a Model block port, you connect the signal to the corresponding port of the referenced model.

The port of the referenced model determines what connections the Model block supports. For example, a port might require a bus or a signal with a data type of uint8.

For more information about model reference interfaces, see Define Model Reference Interfaces.

Configure Model Block Parameters

You can use Model block parameters to specify:

  • Simulation mode

  • Code interface

  • Model events, such as initialize, reinitialize, reset, and terminate events

  • Scheduling via periodic event ports or the Schedule Editor

  • Instance-specific parameter values for model arguments

  • Local solver

For information about the block parameters and the values they support, see Model.

When a Model block references another model, double-clicking the Model block opens the referenced model, not the Block Parameters dialog box.

To access block parameters, select the Model block. Then, open the Property Inspector or Block Parameters dialog box.

  • Property Inspector — In the Simulink® Toolstrip, on the Modeling tab, in the Design gallery, select Property Inspector.

  • Block Parameters dialog box — In the Simulink Toolstrip, on the Model Block tab, click Block Parameters.

Related Topics