主要内容

upgradeadvisor

Open Upgrade Advisor

Syntax

upgradeadvisor('modelname')
upgrader = upgradeadvisor('modelname')

Description

upgradeadvisor('modelname')opens the Upgrade Advisor for the model specified bymodelname. This command loads the model if necessary, but does not open it in the Simulink®Editor. Use the Upgrade Advisor to help you upgrade and improve models with the current release.

upgrader = upgradeadvisor('modelname')returns an object that you can use to analyze and upgrade a hierarchy of models programmatically. If you specify an output, then the Upgrade Advisor does not open. You can use the methodsanalyzeandupgradewith theupgraderobject output of theupgradeadvisorfunction.

  • To programmatically analyze a model for recommended upgrades, create anupgraderobject and use the methodanalyze.

  • To programmatically analyze and upgrade a model, create anupgraderobject and use the methodupgrade.

  • To configure options before running analyze or upgrade, seeExamples.

Tip

For an example showing how to programmatically upgrade a whole project, seeUpgrade Simulink Models Using a Project.

Input Arguments

modelname

Name or handle to the model, specified as a character vector.

Output Arguments

upgrader

Object for analyzing and upgrading the hierarchy of models programmatically.

Examples

Open Upgrade Advisor on a Model

To open the Upgrade Advisor on thevdpexample model:

upgradeadvisor('vdp')

To open the Upgrade Advisor on the currently selected model:

upgradeadvisor(bdroot)

Programmatically Analyze and Upgrade a Model

  1. Get anupgraderobject. This example uses a writable copy of thevdpmodel.

    load_system('vdp'); save_system('vdp',fullfile(tempdir, 'myvdp')) upgrader = upgradeadvisor('myvdp')
    upgrader = Upgrader with properties: ChecksToSkip: {} SkipLibraries: 0 SkipBlocksets: 1 OneLevelOnly: 0 ShowReport: 1 RootModel: 'myvdp' ReportFile: ''

  2. To analyze the model for recommended upgrades, following library links and model references, run:

    analyze(upgrader);
    You see a report of issues found.

  3. To analyze the model and automatically fix all issues (where automated fixes are available), run:

    upgrade(upgrader);

    This command follows library links and model references, and saves any fixes to the model files.

    You see a report of issues found and actions taken.

  4. To find the location of the report:

    reportLocation = upgrader.ReportFile

  5. You can configure options before running analyze or upgrade.

    • Specify checks to skip before running analyze or upgrade. Find the ID for a check in the Upgrade Advisor by right-clicking the check and selectingSend Check ID to Workspace. Then set theupgrader.ChecksToSkipproperty. For example:

      upgrader.ChecksToSkip = {'mathworks.design.CSStoVSSConvert'}; upgrade(upgrader);

    • Specify running the Upgrade Advisor on only the current model without following library links or model references, or analyzing test harnesses that are saved as external models:

      upgrader.OneLevelOnly = true; % default false

    • Specify running the Upgrade Advisor on the current model, following model references but not library links:

      upgrader.SkipLibraries = true; % default false

    • Specify running the Upgrade Advisor on the current model, including upgrading files in blocksets or toolboxes:

      upgrader.SkipBlocksets = false; % default true
      By default, the Upgrade Advisor does not upgrade files in blocksets or toolboxes. The Upgrade Advisor detects blocksets from the output of版本and the existence of aContents.mfile.

    • To turn off showing the report after analyze or upgrade, set:

      upgrader.ShowReport = false; % default true

Tip

For an example showing how to programmatically upgrade a whole project, seeUpgrade Simulink Models Using a Project.

Tips

  • The Upgrade Advisor can identify cases where you can benefit by changing your model to use new features and settings in Simulink. The Advisor provides advice for transitioning to new technologies, and upgrading a model hierarchy.

    The Upgrade Advisor can also identify cases where a model will not work because changes and improvements in Simulink require changes to a model.

    The Upgrade Advisor offers options to perform recommended actions automatically or instructions for manual fixes.

Alternatives

You can also open the Upgrade Advisor from the Simulink Editor. In theModelingtab, selectModel Advisor>Upgrade Advisor.

Alternatively, you can open the Upgrade Advisor from the Model Advisor. In the Model Advisor, underBy Taskchecks, expand the folderUpgrading to the Current Simulink Versionand select the checkOpen the Upgrade Advisor.

版本历史

Introduced in R2012b