Create a Referenced Model

A model becomes a referenced model when a Model block in some other model references it. Any model can function as a referenced model, and such use does not preclude using it as a separate model also.

For a video introducing how to create model references, see Getting Started with Model Referencing.

To create a reference to a model (referenced model) in another model (parent model):

  1. If the folder containing the referenced model you want to reference is not on the MATLAB® path, add the folder to the MATLAB path.

  2. In the referenced model:

    • Set Configuration Parameters > Model Referencing > Total number of instances allowed per top model to:

      • One, if the hierarchy uses the model at most once

      • Multiple, to use the model more than once per top model. To reduce overhead, specify Multiple only when necessary.

      • Zero, which precludes referencing the model

  3. Create an instance of the Model block in the parent model by dragging a Model block instance from the Ports & Subsystems library to the parent model. The new block is initially unresolved (specifies no referenced model) and has the following appearance:

  4. Open the new Model block's parameter dialog box by double-clicking the Model block. See Navigating a Model Block for more about accessing Model block parameters.

  5. Enter the name of the referenced model in the Model name field. This name must contain fewer than 60 characters. (See Name Length Requirement.)

  6. Click OK or Apply.

If the referenced model contains any root-level inputs or outputs, Simulink® displays corresponding input and output ports on the Model block instance that you have created. Use these ports to connect the referenced model to other ports in the parent model.

A signal that connects to a Model block is functionally the same signal outside and inside the block. Therefore that signal is subject to the restriction that a given signal can have at most one associated signal object. See Simulink.Signal for more information. For information about connecting a bus signal to a referenced model, see Bus Usage Requirements.

Masking Model Blocks

You can use the masking facility to create custom dialog boxes and icons for Model blocks. Masked dialog boxes can make it easier to specify additional parameters for Model blocks. For information about block masks, see Block Masks.

See Also


Related Examples

More About

Was this topic helpful?