In a project, you can use impact analysis to find out the impact of changing particular files. Investigate dependencies visually and explore the structure of your project. Analyze selected or modified files to find their required files and the files they affect. Impact analysis can show you how a change affects other files before you make the change. For example, you can:
Investigate the potential impact of a change in requirements by finding the design files linked to the requirements document.
Investigate change set impact by finding upstream and downstream dependencies of modified files before committing the changes. Finding these dependencies can help you identify design and test files that need modification, and help you find the tests you need to run.
After performing dependency analysis, you can open or label the files, export the results as workspace variables, images, or reloadable files, or send files for custom task processing. Exporting the results enables further processing or archiving of impact analysis results. You can add the exported list of files to reports or artifacts that describe the impact of a change.
For an example showing how to perform file-level impact analysis to find and run the tests affected by modified files, see Perform Impact Analysis with a Project.
To investigate dependencies, run a dependency analysis on your project.
In the project, in the Views pane, select Dependency Analysis. If you want to analyze the dependencies of external toolboxes, select Options > Analyze External Toolboxes.
The Impact View graph displays the structure of all analyzed dependencies in the project. Project files that are not detectable dependencies of the analyzed files do not appear on the graph.
After you run the first dependency analysis of your project, clicking Analyze again produces incremental updates. If you want to analyze changes in external toolboxes, turn off the incremental update option.
After performing dependency analysis, the Impact view shows:
A graph of your project structure and its file dependencies, showing how files such as models, libraries, subsystem, functions, data files, and source and derived files relate to each other.
Required products and toolboxes.
Relationships between source and derived files (such as
.mex files), and
between C/C++ source and header files. You can see what code is
generated by each model, and find what code needs to be regenerated if
you modify a model.
Warnings about problem files, such as missing files, files not in the project, unsaved changes, and out-of-date derived files.
For next steps:
To try a dependency analysis on example files, see Perform Impact Analysis with a Project.
After running dependency analysis in a project, the Impact view shows 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.
After running dependency analysis, view the required products for the whole project listed in the right pane.
To find which file is introducing a product dependency, hover over the product name and click Find Usages.
The graph updates to show only the files using the selected product.
To return to the full project view, click the arrow to undo the
filtering and return to the previous view. Alternatively, clear the
filter in the search box (e.g., Usages of
To view required products of selected files, select some files by clicking the graph or a legend.
If a required product is missing, the product list labels it Missing. See Check Dependency Results and Resolve Problems.
After a dependency analysis, to find out the impact of particular files, in the Impact View use the context menu, or use controls in the View and Impact Analysis sections of the Dependency Analysis tab. You can simplify the graph by investigating dependencies of particular files.
Select files to investigate using one of these methods:
Select files in the graph or select groups of files by clicking the legend. For example, select all model files by clicking Simulink Model in the File Type legend. Change the legend, in the View section of the toolstrip, using the Group By menu, for example to show problem types, status, or labels.
To select modified files, problem files or external files, use the Select menu in the Impact Analysis section of the toolstrip.
To find dependencies, right-click selected files and use the context menu. Select Find All Dependencies, Find Impacted Files, or Find Required Files.
Alternatively, select files and then use the Dependency Analysis tab. In the Impact Analysis section, select Find and then specify the range of dependencies you want to display: All Dependencies of Selection, Files Impacted by Selection, or Files Required by Selection.
The graph shows the selected files and their file dependencies.
To reset the graph to show all analyzed dependencies in the project, on the Dependency Analysis tab, in the Impact Analysis section, select Find > All Files. Alternatively, if you filter files, click the arrow to undo filtering and return to previous views.
To see the blocks that have dependencies, expand individual files in the graph by clicking the arrows next to the file names.
The Impact graph expands the dependent file. You can see the subsystems that have dependencies. You can view dependent blocks, models, libraries, library blocks and requirements.
To highlight a dependent block in the model, double-click the block name in the expanded file.
To expand all files in the graph, in the View section, click Expand All.
You can find impacted files for a single block in a library, or for a single requirement. To find specific upstream or downstream dependencies at the block or requirement level, right-click a block or requirement and use the context menu. Select Find All Dependencies, Find Impacted Files, or Find Required Files.
To investigate changes in modified files, right-click and select Compare to Ancestor or Compare to Revision. See Compare Revisions.
For large projects, viewing the results in a table can be easier to navigate. Click Impact View to switch to Table View. See Investigate Problem Files in Table View.
To highlight or select groups of files:
Click a legend item to select all files of that type. For example, to select all model files, in the File Type legend, click Simulink Model. Selected files display a blue box.
To choose a legend, on the Dependency Analysis tab, in the View section, use the Group By control. Choose a category such as file type, project status, source control status, labels, project, and problem type. Files in the graph are colored to indicate the legend category on each file.
If your project is under source control, to show modified files, select Group By > SVN (or Git).
To identify whether files are in your project or a referenced project, select Group By > Project.
To perform file operations:
Take actions to resolve problem files. For example, right-click a problem file and select Add to Project or Add External File. For advice on resolving problem files, see Check Dependency Results and Resolve Problems.
Hover over a file to read the file name in the tooltip at any zoom level. Double-click to open the file. Expand or collapse files in the graph by clicking the arrows next to the file names. View dependent blocks under an expanded file, and double-click a dependent block to highlight it in the model.
Right-click files in the graph to use commands such as Open, Compare, or Source Control operations.
You can perform file operations on multiple files. To fit the view to the currently selected files, press F.
Export selected files using the Export menu. You can switch to the files or custom task views with the files selected, or send the file paths to a workspace variable. You can also save and reload graph layouts, and save the graph as an image file, using Save As. Your graph layout is saved with the project. See Save, Open, and Compare Dependency Analysis Results.
Alternatively, you can work with the graph information programmatically. See Automate Simulink Project Tasks Using Scripts.