Perform Block-Level Impact Analysis Using Dependency Analyzer
This example shows how to identify the impact of changing a single block in a Simulink® model on the other files in your design. You can analyze the impact of changes you make before you make the change.
Open Dependency Analyzer
Open the Dependency Analyzer app on the sldemo_mdlref_depgraph
model. In the Simulink® Editor, in the Modeling tab, on the far right of the Design section, click the down arrow to expand the gallery. Under Dependencies, click Dependency Analyzer.
Alternatively, in the MATLAB® Command Window, enter this command:
depview("sldemo_mdlref_depgraph");
For information about opening the Dependency Analyzer for a project, file, or folder, see Open the Dependency Analyzer App.
For a model, the Dependency Analyzer shows the Model Hierarchy view and filters non-model files from the view. To see all file dependencies, clear the Model Hierarchy filter.
The graph shows:
The model hierarchy, including how files such as models, libraries, functions, data files, source files, and derived files relate to each other. Each item in the graph represents a file and each arrow represents a dependency.
Relationships between source and derived files such as, M and P files, SLX and SLXC, and C and MEX files.
The Properties pane shows:
Model details
Required products and add-ons for the entire hierarchy
Any problems in the hierarchy, such as missing files and files with unsaved changes
Determine Impact of Modifying Block
For model files, you can investigate dependencies at a finer level.
1. Select a model and inspect the Blocks section in the Properties pane. The Dependency Analyzer lists only the blocks that have dependencies in the current graph. The app lists child blocks under the parent block in a tree.
The sldemo_mdlref_depgraph
model has four blocks with file dependencies in the graph.
None of the blocks in the sldemo_mdlref_F2C
model depend on nor affect any other files in the graph.
2. To determine the impact of changing the Fahrenheit to Celsius
block in the sldemo_mdlref_heater
model before you make changes, follow these steps.
a. Select the sldemo_mdlref_heater
model.
b. In the Blocks pane, select the checkbox that corresponds to the Fahrenheit to Celsius
block, then click Impacted.
The graph shows only the files and blocks that are impacted by the changes you make to the Fahrenheit to Celsius
block. Changing the Fahrenheit to Celsius
block affects the sldemo_mdlref_depgraph
model. The change affects only one of the four blocks in the sldemo_mdlref_depgraph
model.
To clear the block-level impact analysis, click the Impacted: sldemo_mdlref_heater.slx, sldemo_mdlref_heater/Fahrenheit to Celsius
filter.