Main Content

Model dependencies


Model dependencies are files and data that potentially impact simulation results. 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 avoid invalid simulation results, list all user-created dependencies in the Model dependencies parameter. When determining whether a model reference target is up to date, Simulink examines dependencies that it automatically identifies and files specified by the Model dependencies parameter.

Category: Model Referencing


Default: ''

Specify dependencies as a cell array of character vectors, where each cell array entry is one of the following:

  • File name — Simulink 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 — Simulink treats every file in that folder as a dependent file. Simulink does not include files of subfolders of the folder you specify.

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

For example:

{'D:\Work\parameters.mat', '$MDL\mdlvars.mat', ...


  • To improve rebuild detection speed and accuracy, use the Model dependencies parameter to specify user-created dependencies when the Rebuild parameter is set to either If any changes detected or If any changes in known dependencies detected.

  • To prevent invalid simulation results, if the Rebuild setting is If any changes in known dependencies detected, add every user-created dependency.

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

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

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

Command-Line Information

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

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo recommendation

See Also


Model Settings

Related Topics