Main Content

Work with Referenced Models and Library Links

The model comparison report applies only to the currently selected models, and does not include changes to any referenced models or linked libraries. The comparison report shows only changes in the files selected for comparison.

Tip

If you want to examine your whole hierarchy instead, try using a project, where you can examine modified files and dependencies across your whole project, and compare to selected revisions. See Project Management.

If you are comparing models that contain referenced models with the same name, then your MATLAB® path can affect the results. For example, this can happen if you generate a model comparison report for the current version of your model and a previous baseline. Make sure that your referenced models are not on your MATLAB path before you generate the report.

The reason why results can change is that Simulink® records information in the top model about the interface between the top model and the child model. This interface information in the top model enables incremental loading and diagnostic checks without any need to load child models.

When you load a model (for example, to compare) then Simulink refreshes the interface information for referenced models if it can find the child model. Simulink can locate the child model if it is on the path. If another model of the same name is higher on the path, Simulink updates the interface information for that other model before comparing. This can produce entries for interface changes for model reference blocks in the comparison report. Make sure your referenced models are not on your path before you generate the report, to avoid these interface changes in the results. If both model versions are off the path, the interface information in the top model is not refreshed during the comparison process. Instead the cached information is used, resulting in a valid comparison report.

With library links, Simulink does not update the cached interface information when comparing, and so the report correctly captures library interfaces. However with both referenced models and library links, Simulink updates the information when displaying the model. When displaying report items in original models, you may see that Simulink finds another model or library that is higher in the path. To obtain the clearest results, make sure that the models and associated libraries are temporarily removed from the path. By removing the files from the path you will see unresolved library links and referenced models when you view the original models, but their interfaces will be correct and will correctly align with the comparison report.