Check Dependency Results and Resolve Problems

In a project, under Views, select Dependency Analysis. If you have not yet run an analysis, click Analyze. After you run a dependency analysis, you see the Impact graph for the whole project in Impact View. The project dependency analysis identifies problems, such as missing files, files not in the project, unsaved changes, and out-of-date derived files. You can examine problem files and resolve issues using the Impact View or the Table View.

To show only problem files, hover over the Problems heading in the right pane of the Impact view and click Find All.

Problem Message

Description

Fix

Not in project

The file is not in the project.

Add it to the project.

You do not need to add all required files to the project. For example, you can exclude derived S-Function binary files that the source code in your project generates. See Work with Derived Files in Projects.

To remove a file from the problem list without adding it to the project, right-click the file and select Add External File.

Missing project file

The file is in the project but does not exist on disk.

Create the file, or recover it using source control.

Outside project root

The file is outside the project root folder.

If this is OK, set the file as an external file. Otherwise move it under the project root.

If you need a file that is outside the project root to be in your project, copy or move the file within the project root, and add it to the project and the path. Remove the original file location from the path.

If required files are outside your project root, you cannot add these files to your project. This dependency might not indicate a problem if the file is on your path and is a utility or resource that is not part of your project. Use dependency analysis to ensure that you understand the design dependencies.

In unreferenced project

The file is within a project that is not referenced by the current project.

Add the project containing the file as a project reference.

Missing file

The file or variable could not be found.

If this status is acceptable, set the file as an external file.

Unsaved changes

The file has unsaved changes in the MATLAB® or Simulink® editors

Save the file.

Derived file out of date

The derived file is older than the source file it was derived from.

Regenerate the derived file. If it is a P-file, you can regenerate automatically by running the project checks.

On the Project tab, click Check Project and follow prompts to rebuild files.

If you rename a source file, the project detects impact in the derived file and prompts you to update it.

Missing product

The project has a dependency on a missing product.

Fix models by installing missing products.

If you open a model that contains built-in blocks or library links from missing products, you see labels and links to help you fix the problem.

  • Blocks are labeled with missing products (for example, SimEvents not installed)

  • Tooltips include the name of the missing product

  • Messages provide links to open Add-On Explorer and install the missing products

To find a link to open Add-On Explorer and install the product:

  • For built-in blocks, open the Diagnostic Viewer, and click the link in the warning.

  • For unresolved library links, double-click the block to view details and click the link.

Product dependencies can occur in many other ways, for example in callbacks, so in this case you cannot easily see where the missing product is referenced. Fix models by installing missing products.

Investigate Problem Files in Impact View

Use the Impact View to investigate your project dependencies graphically.

  1. In the Impact view, to see problem files for the whole project, clear any file selections by clicking a blank area of the graph. View any problem files listed in the right panel.

  2. To view the files that use a problem file, hover over the problem file and click Find Dependencies.

    The graph updates to display only the problem file and its dependencies, and the problem message in the right panel.

  3. Take actions to resolve the problem file. For example, right-click the file and select Add to Project or Add External File.

  4. Click a problem file and check the path shown on the right. Check if required files are outside your project root.

  5. Examine or edit dependencies by opening referencing components (such as a block or line of MATLAB code that references a problem file). To open a referencing component, expand a file in the graph, and double-click an item in the list.

    MATLAB files open in the MATLAB Editor, and Simulink models open in the Simulink Editor with the referencing component block highlighted.

  6. To return to the full project view, clear the filter in the search box (e.g., Dependencies of filename”).

For more ways to work with the Impact view, see Perform Impact Analysis.

Investigate Problem Files in Table View

  1. Select Table View and sort by the Problem Description column.

  2. Click each file in the problem list.

    Use the lower pane to display the files that use the selected file. You can view Directly Impacted Files or switch to Directly Required Files. You can select multiple files or dependencies at once and find the impacts or requirements of them all.

    For a selected file, check the message in the Problem Description column.

  3. In the dependencies table, check the problem description and project status of dependent files.

  4. To open the referencing component for editing, right-click a file in the lower table and select Open.

  5. Check the path, where $ indicates the project root. Check if required files are outside your project root.

  6. To remove a file from the problem list without adding it to the project, right-click the file and select Add External File. The file disappears from the problem list. The next time you run a dependency analysis, this file does not appear in the problem list.

Related Topics