Upgrade Simulink Models Using a Simulink Project
Easily upgrade all the models in your project either programmatically or using the Upgrade Project tool in Simulink Project.
Setting Up the Example Files and Opening Simulink Project
1. Run the following commands to create and open a working copy of the project files.
Simulink.ModelManagement.Project.projectDemo('airframe', 'svn'); rebuild_s_functions('no_progress_dialog');
Creating sandbox for project. Created example files in "/private/tmp/BR2017bd_684186_4260/bml.batserve.044429/work/MATLAB/projects/slexamples/airframe2" Initializing: Project Path Setting up working folders Identifying shadowed project files Building with 'Xcode with Clang'. MEX completed successfully.
The project example copies files to a new folder so that you can edit them and use them under SVN version control. Placing your files under version control lets you compare the upgraded model files with the original versions.
Programmatic Upgrade Using Upgrade Advisor
2. Click the Files node in the Project user interface and expand the "utilities" folder. Right-click the file "upgrade_project.m" and select "Run".
The upgrade_project function uses the project dependency analysis to find the top-level models in the project. When first opened, this example project has no previous dependency analysis results, and so dependency analysis is run.
The upgrade_project function runs the Upgrade Advisor on the top-level models in this project. This can take a few minutes. You can see progress information in the MATLAB command window. When the upgrade completes, view the report summarizing the upgrade tasks performed.
Add New SLX Files to the Project
3. Click the Modified Files node to see the files in your sandbox that were modified by the Upgrade Advisor. Look in the models folder to see that some MDL files show the status "Missing". This is because they have been upgraded to SLX files. To fix this, run the Project Checks by clicking Run Checks > Check Project in the Simulink Project tab.
Click "Fix" to resolve the problem.
To complete the fixes, click Yes. The project checks rerun automatically to verify that the problem is resolved. To learn more about how project checks support upgrading from MDL format model files to SLX format, run the example "sldemo_slproject_convert_to_SLX".
Review the Upgrades
You can use the comparison tool from the project to understand the changes you have made, perhaps as part of a peer-review process.
4. Right-click a file in the Modified File view and select "Compare to Ancestor".
This opens a comparison using the MATLAB Comparison Tool, comparing the modified version of the file in your sandbox against its ancestor stored in your version control tool. If you select a Simulink model this runs a Simulink® Model Comparison.
Automatically Upgrade All Project Models at Once
Upgrade all models in your Simulink project to the latest release using a simple workflow. The Upgrade Project tool can apply all fixes automatically when possible, upgrade all model hierarchies in the project at once, and produce a report. You do not need to open the Upgrade Advisor.
2b. In the Simulink Project tab click Run Checks > Upgrade.
This loads the upgrade advisor checks and runs a dependency analysis on your project to ensure the project hierarchy is handled correctly.
Click Upgrade to run all upgrade checks on all models and libraries in your project. If any check fails and there is a fix available, the project automatically applies the fix and runs the relevant checks again to ensure they now pass.
Inspect the results of the upgrade in the report.