|On this page…|
The Model Dependency Viewer displays a dependency view of a model. The dependency view is a graph of all the models and libraries referenced directly or indirectly by the model. You can use the dependency view to quickly find and open referenced libraries and models. To identify and package all required files, see instead Analyze Model Dependencies.
The Model Dependency Viewer allows you to choose between the following types of dependency views of a model reference hierarchy.
A file dependency view shows the model and library files referenced by a top model. A referenced model or library file appears only once in the view even if it is referenced more than once in the model hierarchy displayed in the view. A file dependency view consists of a set of blocks connected by arrows. Blue blocks represent model files; brown boxes, libraries. Arrows represent dependencies. For example, the arrows in the following view indicate that the aero_guidance model references two libraries: aerospace and simulink_need_slupdate.
An arrow that points to the library from which it emerges indicates that the library references itself, i.e., blocks in the library reference other blocks in that same library. For example, the preceding view indicates that the aerospace library references itself.
A file dependency view optionally includes a legend that identifies the model in the view and the date and time the view was created.
A referenced model instances view shows every reference to a model in a model reference hierarchy (see Model Reference) rooted at the top model targeted by the view. If a model hierarchy references the same model more than once, the referenced model appears multiple times in the instance view, once for each reference. For example, the following view indicates that the model reference hierarchy rooted at sldemo_mdlref_depgraph contains two references to the model sldemo_mdlref_F2C.
In an instance view, boxes represent a top model and model references. Boxes representing accelerated-mode instances (see Referenced Model Simulation Modes) have filled triangles in their corners; boxes representing normal-mode instances, have unfilled triangles in their corners. For example, the following diagram indicates that one of the references to sldemo_mdlref_F2C operates in normal mode; the other, in accelerated mode.
Boxes representing protected referenced models have a lock icon, and the model name has the .slxp extension. Protected referenced model boxes have no expand(+)/collapse(–) button.
An instance view appends PIL to the names of models that run in Processor-in-the-Loop mode (see Specify the Simulation Mode). For example, the following dependency instance view indicates that the model named rtwdemo_pil_component runs in processor-in-the-loop mode.
An instance view displays warning icons on instance boxes to indicate that a reference is configured to run in Normal mode actually runs in Accelerated mode because it is directly or indirectly referenced by another model reference that runs in Accelerated mode.
The warning icon is a yellow triangle .
The Model Dependency Viewer displays a graph of all the models and libraries referenced directly or indirectly by the model. You can use the dependency viewer to quickly find and open referenced libraries and models.
To display a dependency view for a model:
Open the model.
Select Analysis > Model Dependencies > Model Dependency Viewer, then select the type of view you want to see:
Models & Libraries
Referenced Model Instances
The Model Dependency Viewer appears, displaying a dependency view of the model.
The Model Dependency Viewer allows you to manipulate dependency views in various ways. See the following topics for more information:
You can change the type of dependency view displayed in the viewer.
To change the type of dependency view, in the Model Dependency Viewer:
Select View > Dependency Type > Model File Dependencies (see File Dependency View )
Select View > Dependency Type > Referenced Model Instances (see Referenced Model Instances View ).
By default a file dependency view includes libraries on which a model depends.
To exclude block libraries:
Deselect View > Include Libraries.
By default, a file dependency view omits MathWorks® block libraries when View > Include Libraries is selected.
To include libraries supplied by MathWorks:
Select View > Show MathWorks Dependencies.
By default the orientation of the dependency graph displayed in the viewer is vertical.
To change the orientation to horizontal:
Select View > Orientation > Horizontal.
You can expand or collapse each model or library in the dependency view to display or hide the dependencies for that model or library.
To expand or collapse views:
Click the expand(+)/collapse(-) button on the box representing the model or library to expand or collapse that view.
You can enlarge or reduce the size of the dependency graph displayed in the viewer.
To zoom a dependency view in or out, do either of the following:
Press and hold down the spacebar key and then press the + or - key on the keyboard.
Move the scroll wheel on your mouse forward or backward.
To fit the view to the viewer window:
Press and release the spacebar key.
You can move a dependency view to another location in the viewer window.
To move the dependency view:
Move the cursor over the view.
Press your keyboard's space bar and your mouse's left button simultaneously.
Move the cursor to drag the view to another location.
You can rearrange a dependency view by moving the blocks representing models and libraries. This can make a complex view easier to read.
To move a block to another location:
Select the block you want to move by clicking it.
Drag and drop the block in the new location.
The dependency view can display a legend that identifies the model in the view and the date and time the view was created.
To display or hide a dependency view's legend:
Select View > Show Legend from the viewer's menu bar.
In an instance view (see Referenced Model Instances View) , you can display the full path of a model reference in a tooltip or in the box representing the reference.
To display the full path in a tooltip:
Move the cursor over the box representing the reference in the view.
A tooltip appears, displaying the path displays the full path of the Model block corresponding to the instance.
To display full paths in the boxes representing the instances:
Select View > Show Full Path.
Each box in the instance view now displays the path of the Model block corresponding to the instance. The name of the referenced model appears in parentheses as illustrated in the following figure.
After changing a model displayed in a dependency view or any of its dependencies, you must update the view to reflect any dependency changes.
To update the view:
Select View > Refresh from the dependency viewer's menu bar.
You can use a dependency view to browse a model's dependencies:
To open a model or library displayed in the view, double-click its block.
To display the Model block corresponding to an instance in an instance view, right-click the instance and select Highlight Block from the menu that appears.
To open all models displayed in the view, select File > Open All Models from the viewer's menu bar.
To save all models displayed in the view, select File > Save All Models.
To close all models displayed in the view, select File > Close All Models.
You can save a dependency view for later viewing.
To save the current view:
Select File > Save As from the viewer's menu bar, then enter a name for the view.
To reopen the view:
Select File > Open from any viewer's menu bar, then select the view you want to open.