This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Model References

Reuse models as blocks in other models

You can include one model in another by using a Model block. Each instance of a Model block is a model reference. For simulation and code generation, blocks within a referenced model execute together as a unit. The model that contains a referenced model is a parent model. A collection of parent and referenced models constitutes a model hierarchy.

Like subsystems, model references allow you to organize large models hierarchically. Like libraries, model references allow you to define a set of blocks once and use it repeatedly. Model references provide several advantages that are unavailable with subsystems and libraries. Several of these advantages result from referenced models compiling independent of the context of the Model block, including:

  • Modular development

  • Model protection

  • Inclusion by reference

  • Incremental loading

  • Accelerated simulation

  • Incremental code generation

  • Independent configuration sets


ModelReference another model to create model hierarchy
Variant Subsystem, Variant ModelTemplate subsystem containing Subsystem blocks or Model blocks as Variant choices


depviewDisplay graph of model referencing dependencies with or without library dependencies
find_mdlrefsFind Model blocks and referenced models at all levels or at top level only
Simulink.fileGenControlSpecify root folders for files generated by diagram updates and model builds
Simulink.SubSystem.convertToModelReferenceConvert subsystem to model reference
slbuildBuild standalone executable or model reference target for model


Simulink.BlockPathFully specified Simulink block path


Determine When to Reference Models

Model Reference Basics

Create a model hierarchy by referencing one model in another model. A referenced model contains blocks that execute together as a unit.

Component-Based Modeling Guidelines

Define model components for large models and multiuser development teams.

Capabilities of Model Components

Organize your model into independently functional parts.

Model Reference Requirements and Limitations

Model references have requirements and limitations relating to features such as reusability, simulation modes, masking, and debugging.

Set Up Model References

Reference Existing Models

Include a model in another model.

Reference Protected Models from Third Parties

Use a protected model that you received from a third party.

Convert Subsystems to Referenced Models

Prepare a subsystem for conversion, convert the subsystem to a model, and compare simulation results before and after conversion.

Inspect Model Hierarchies

Examine the contents, structure, model versions, and logged signals in a model hierarchy.

Model Reference Interface

Ports in the referenced model correspond with ports at the model reference. Signals that cross the model boundary must meet certain requirements.

Modify Referenced Models for Conditional Execution

Execute referenced models conditionally, similar to conditional subsystems.

Set Configuration Parameters for Model Referencing

Configuration parameter values can be different in top models and referenced models. There are some configuration parameter values that have special requirements or behavior with model referencing.

Parameterize Instances of a Reusable Referenced Model

When you model a reusable component as a referenced model, to configure each instance of the component to use different values for block parameters, create model arguments.

Referenced Model Sample Times

A referenced model can inherit sample times from the model that references it.

Simulate Model Hierarchies

Simulate Model Hierarchies

Select the simulation mode for simulating models in a model hierarchy.

Model Reference Simulation Targets

A simulation target, or SIM target, is a MEX-file that implements a referenced model that executes in accelerator mode.

Share Simulation Builds for Faster Simulations

Use Simulink cache files to share referenced model build artifacts without repeating the cost of a first-time build.

Simulate Multiple Referenced Model Instances in Normal Mode

Simulate a model that contains multiple instances of a referenced model.

Featured Examples