Main Content


Run Model Advisor from MATLAB file


To run the Model Advisor, use instances of this class in MATLAB® programs. For example, you can perform a standard set of checks.

Many Simulink.ModelAdvisor object methods require or return IDs. An ID is a unique identifier for a Model Advisor check, task, or group. IDs must remain constant. A Simulink.ModelAdvisor object includes methods that enable you to retrieve the ID or IDs for:

  • All checks, tasks, and groups

  • Checks belonging to groups and tasks

  • The active check

  • Selected checks, tasks, and groups

To find check IDs in the Model Advisor, use the check context menu.

Check Title, ID, or location of the MATLAB source code
  1. On the model window toolbar, select Settings > Preferences.

  2. In the Model Advisor Preferences dialog box, select Show Source Tab.

  3. In the right pane of the Model Advisor window, click the Source tab. The Model Advisor window displays the check Title, TitleId, and location of the MATLAB source code for the check.

Check ID
  1. In the left pane of the Model Advisor, select the check.

  2. Right-click the check name and select Send Check ID to Workspace. The ID is displayed in the Command Window and sent to the base workspace.

Check IDs for selected checks in a folder
  1. In the left pane of the Model Advisor, select the checks for which you want IDs. Clear the other checks in the folder.

  2. Right-click the folder and select Send Check ID to Workspace. An array of the selected check IDs are sent to the base workspace.

If you have a Simulink® Check™ license, consider using the (Simulink Check) function or the Advisor.Application (Simulink Check) run (Simulink Check) method instead of the Simulink.ModelAdvisor runCheck or runTask functions.

Consider using Advisor.Application class if you have a large model with subsystems and model references. Advisor.Application does not run checks on library models. If you want to run checks on multiple independent models that are not in a model reference hierarchy or you want to leverage parallel processing, use to run Model Advisor checks on your model.



MATLAB creates an instance of this object for each model that you open in the current MATLAB session. To get a handle to a model's Model Advisor object, execute this command: ma = Simulink.ModelAdvisor.getModelAdvisor(system) where system is the name of the model or subsystem that you want to check. Your program can then use the Model Advisor object methods to initialize and run the Model Advisor checks.

Input Arguments

expand all

Model or subsystem that the Model Advisor checks.

Data Types: char


expand all

A value of true displays input parameters in the Model Advisor report. A value of false does not display input parameters in the Model Advisor report.

Data Types: char

Object Functions

closeReport Close Model Advisor report
deselectCheck Clear Model Advisor check
deselectCheckAll Clear Model Advisor checks
deselectCheckForGroup Clear Model Advisor checks for groups
deselectCheckForTask Clear Model Advisor checks that belong to a specified task or set of tasks
deselectTask Clear Model Advisor checks that belong to a specified task or set of tasks
deselectTaskAll Clear all Model Advisor tasks
displayReport Display report in Model Advisor window
exportReport Create copy of Model Advisor report
filterResultWithExclusion Filter excluded objects
getBaselineMode Determine whether Model Advisor is in baseline data generation mode
getCheckAll Get check IDs of all Model Advisor checks
getCheckForGroup Get checks belonging to Model Advisor check group
getCheckForTask Get checks belonging to a task
getCheckResult Get Model Advisor check results
getCheckResultDataObtain Model Advisor check result data
getCheckResultStatusObtain Model Advisor check result status
getGroupAll Get all groups of checks that Model Advisor runs
getInputParameters Get Model Advisor check input parameters
getListViewParameters Get Model Advisor checklist parameters displayed in checklist view
Simulink.ModelAdvisor.getModelAdvisor Get Model Advisor object for system or subsystem
getSelectedCheck Get currently selected Model Advisor checks
getSelectedSystem Get system that Model Advisor targets
getSelectedTask Get selected Model Advisor tasks
getTaskAll Get tasks run by Model Advisor
Simulink.ModelAdvisor.openConfigUI Starts Model Advisor Configuration Editor
Simulink.ModelAdvisor.reportExists Determine whether Model Advisor report exists for model or subsystem
runCheck Run currently selected checks
runTask Run currently selected tasks
selectCheck Select checks
selectCheckAll Select all checks
selectCheckForGroup Select check group
selectCheckForTask Select checks for a specific task or tasks
selectTask Select Model Advisor task
selectTaskAll Select all Model Advisor tasks
setActionEnableSet status for check action
setBaselineMode Set Model Advisor baseline mode
setCheckErrorSeverity Set severity of check failure
setCheckResult Set result for currently running check
setCheckResultData Set result data for currently running check
setCheckResultStatus Set status for currently running check
setListViewParameters Specify list-view parameters for check
setInputParametersSpecify input parameters
verifyCheckRan Verify that Model Advisor ran a set of checks
verifyCheckResult Generate baseline Model Advisor check results file or compare current check results to baseline check results
verifyCheckResultStatus Verify that a model passed or failed a set of checks
verifyHTML Generate baseline Model Advisor report or compare current report to baseline report
Introduced in R2006a