Main Content

Model dependencies

User-created files and data that potentially impact simulation results

Model Configuration Pane: Model Referencing

Description

The Model dependencies configuration parameter improves rebuild detection speed and accuracy by letting you specify user-created dependencies when the Rebuild configuration parameter is set to either If changes detected or If changes in known dependencies detected.

When determining whether a model reference target is up to date, the software examines both:

  • Dependencies that the software automatically identifies, such as referenced models and linked libraries

  • Files specified by the Model dependencies configuration parameter

You do not need to specify automatically identified dependencies in the Model dependencies configuration parameter. The software computes sets of known target dependencies and potential target dependencies.

The software does not automatically identify user-created dependencies, such as MATLAB® scripts and functions (.m) that contain code executed by callbacks.

To prevent invalid simulation results when the Rebuild configuration parameter is set to If changes in known dependencies detected, list all user-created dependencies in the Model dependencies configuration parameter.

To help identify model dependencies, use the Dependency Analyzer. For more information, see Analyze Model Dependencies.

If the software cannot find a specified dependent file when you update or simulate a model that references this model, the software displays a warning.

Set Configuration Parameter for Referenced Model

In a model reference hierarchy, how you open the Configuration Parameters dialog box determines whether you edit the configuration parameter for the top model in the current model hierarchy or the current referenced model.

  • Top model in the current model hierarchy — In the Simulink® Toolstrip, on the Modeling tab, click Model Settings.

  • Current referenced model — In the Simulink Toolstrip, on the Modeling tab, click the Model Settings button arrow. Then, in the Referenced Model section, select Model Settings.

Alternatively, open the referenced model as a top model. Then, in the Simulink Toolstrip, on the Modeling tab, click Model Settings.

Dependencies

To enable this parameter, set Total number of instances allowed per top model to One or Multiple.

Settings

'' (default) | character vector | cell array of character vectors

Specify dependencies as a character vector or cell array of character vectors, where each cell array entry is one of these values:

  • File name — The software looks on the MATLAB path for a file with the given name. If the file is not on the MATLAB path, specify the path to the dependent file. The file name must include a file extension, such as .m.

  • Path to the dependent file — The path can be relative or absolute and must include the file name.

  • Folder — The software treats every file in that folder as a dependent file. Files of subfolders of the folder you specify are not included.

Cell array entries can include:

  • Spaces

  • The token $MDL as a prefix to a dependency to indicate that the path to the dependency is relative to the location of this model file

  • An asterisk (*) as a wild card

  • A percent sign (%) to comment out a line

  • An ellipsis (...) to continue a line

This example shows valid cell array entries.

{'D:\Work\parameters.m', '$MDL\mdlvars.m', ...
'D:\Work\masks\*.m'}

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo recommendation

Programmatic Use

Parameter: ModelDependencies
Type: character vector
Value: any valid value
Default: ''

More About

expand all

Version History

Introduced before R2006a