Documentation

dependencies.fileDependencyAnalysis

Find model file dependencies

Syntax

files = dependencies.fileDependencyAnalysis('modelname')
[files, missing] = dependencies.fileDependencyAnalysis('modelname')
[files, missing, depfile] = dependencies.fileDependencyAnalysis('modelname')
[files, missing, depfile, manifestfile] = dependencies.fileDependencyAnalysis('modelname', 'manifestfile')

Description

files = dependencies.fileDependencyAnalysis('modelname') returns files, a cell array of character vectors containing the full paths of all existing files referenced by the model modelname.

[files, missing] = dependencies.fileDependencyAnalysis('modelname') returns files, all existing files referenced by the model modelname, and any referenced files that cannot be found in missing.

[files, missing, depfile] = dependencies.fileDependencyAnalysis('modelname') also returns depfile, the full path of the user dependencies (.smd) file, if it exists, that stores the names of any files you manually added or excluded.

[files, missing, depfile, manifestfile] = dependencies.fileDependencyAnalysis('modelname', 'manifestfile') also creates a manifest file with the name and path specified in manifestfile.

Input Arguments

modelname

Character vector specifying the name of the model to analyze for dependencies.

manifestfile

(Optional) Character vector to specify the name of the manifest file to create. You can specify a full path or just a file name (in which case the file is created in the current folder). The function adds the suffix .smf to the user-specified name.

Output Arguments

files

A cell array of character vectors containing the full-paths of all existing files referenced by the model modelname. If there is only one dependency, the return is a character vector. If there are no dependencies, the return is empty.

Default: [ ]

missing

A cell array of character vectors containing the names of any files that are referenced by the model modelname, but cannot be found.

Default: [ ]

depfile

Character vector containing the full path of a user dependencies (.smd) file, if it exists, that stores the names of any files you manually added or excluded. Simulink® uses the .smd file to remember your changes the next time you generate a manifest. See Edit Manifests.

Default: [ ]

manifestfile

Character vector containing the name and path of the new manifest file.

Default: [ ]

Examples

The following code analyses the model mymodel for file dependencies:

files = dependencies.fileDependencyAnalysis('mymodel')
If you try dependency analysis on an example model, it returns an empty list of required files because the standard MathWorks® installation includes all the files required for the example models.

Alternatives

You can interactively run dependency analysis from the Simulink project. See Run Dependency Analysis.

To create a report to identify where dependencies arise, find required toolboxes, and for more control over dependency analysis options, you can interactively generate a manifest and report. See Analyze Model Dependencies.

To programmatically check which toolboxes are required, see dependencies.toolboxDependencyAnalysis.

More About

collapse all

Tips

If you try dependency analysis on an example model, it returns an empty list of required files because the standard MathWorks installation includes all the files required for the example models.

Introduced in R2012a

Was this topic helpful?