Documentation

dependencies.toolboxDependencyAnalysis

Find toolbox dependencies

Syntax

names = dependencies.toolboxDependencyAnalysis(files_in)
[names, folders] = dependencies.toolboxDependencyAnalysis(files_in)

Description

names = dependencies.toolboxDependencyAnalysis(files_in) returns names, a cell array of toolbox names required by the files in files_in.

[names, folders] = dependencies.toolboxDependencyAnalysis(files_in) returns toolbox names and also a cell array of the toolbox folders.

    Tip   In a Simulink® project, you can interactively run dependency analysis. You can find the required toolboxes for the whole project or for selected files. You can see which products a new team member requires to use the project, or find which file is introducing a product dependency. See Find Required Toolboxes.

Input Arguments

files_in

Cell array of character vectors containing .m, .mdl, or .slx files on the MATLAB® path. Simulink model names (without file extension) are also allowed.

Default: [ ]

Output Arguments

names

Cell array of toolbox names required by the files in files_in.

folders

(Optional) Cell-array of the required toolbox folders.

Examples

The following code reports the detectable required toolboxes for the model vdp:

files_in={'vdp'};
names = dependencies.toolboxDependencyAnalysis(files_in)
names = 

    'MATLAB'    'Simulink'    'Simulink Coder'

To find all detectable toolbox dependencies of your model and the files it depends on:

  1. Call fileDependencyAnalysis on your model.

    For example:

    files = dependencies.fileDependencyAnalysis('mymodel')
    files = 
        'C:\Work\foo.m'
        'C:\Work\mymodel.mdl'
    
  2. Call toolboxDependencyAnalysis on the files output of step 1.

    For example:

    tbxes = dependencies.toolboxDependencyAnalysis(files)
    tbxes = 
    [1x24 char]    'MATLAB'    'Simulink Coder'    'Simulink'
    

    To view long product names examine the tbxes cell array as follows:

    tbxes{:}
    
    ans =
    Image Processing Toolbox
    
    ans =
    MATLAB
    
    ans =
    Simulink Coder
    
    ans =
    
    Simulink

Related Examples

Alternatives

In a Simulink project, you can interactively run dependency analysis and find the required toolboxes for the whole project or for selected files. See Find Required Toolboxes.

For a model that is not in a project, you can interactively generate a manifest and report. You can create a report to identify where dependencies arise, and control dependency analysis options. See Analyze Model Dependencies.

To programmatically check which files are required, see dependencies.fileDependencyAnalysis.

More About

collapse all

Tips

The function dependencies.toolboxDependencyAnalysis looks for toolbox dependencies of the files in files_in but does not analyze any subsequent dependencies. See Examples.

For command-line dependency analysis, the analysis uses the default settings for analysis scope to determine required toolboxes. For example, if you have code generation products, then the check Find files required for code generation is on by default and Simulink Coder™ is always reported as required. See Required Toolboxes in the manifest documentation for more examples of how your installed products and analysis scope settings can affect reported toolbox requirements.

Introduced in R2012a

Was this topic helpful?