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.

The dependencies automatically include the model and linked library files, so you do not need to specify those files in the Model dependencies configuration parameter.

Simulink® does not automatically identify user-created dependencies. Examples of user-created dependencies are:

  • MATLAB® files that contain code executed by callbacks

  • MAT files that contain definitions for variables used by the model that are loaded as part of a customized initialization script

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

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. When determining whether a model reference target is up to date, the software examines dependencies that it automatically identifies and files specified by the Model dependencies parameter.

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 or .mat.

  • 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.mat', '$MDL\mdlvars.mat', ...
'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: ''

Version History

Introduced before R2006a