| Simulink® Verification and Validation™ | ![]() |
| On this page… |
|---|
Custom tasks provide a method for adding checks to the Model Advisor tree. You define custom tasks in one or more functions that specify the properties of each instance of the ModelAdvisor.Task class. You must define one instance of this class for each custom task that you want to add to the Model Advisor, and register the custom task as described in Registering Custom Checks, Tasks, and Groups. The sections that follow describe how to define custom tasks.
The following table describes the properties of the ModelAdvisor.Task class:
| Property | Data Type | Default Value | Description |
|---|---|---|---|
| DisplayName | String | '' (null string) | Name of the task as it should appear in Model Advisor. |
| ID | String | '' (null string) | Permanent, unique identifier for the task. The Model Advisor automatically assigns a string toID if you do not specify it. |
| Description | String | '' (null string) | Description of the task, which Model Advisor displays in the Analysis box. |
| Visible | Boolean | true | Show or hide task?
|
| Enable | Boolean | true | Can user enable and disable task?
|
| Value | Boolean | true | Initial status:
|
| LicenseName | Cell array | { } (empty cell array) | Cell array of names of product licenses required to enable
the check. Model Advisor does not display the check if license requirements
are not met. If ModelAdvisor.Check LicenseName is specified, the Model Advisor displays the check when the union of both properties is true. |
| MAObj | Simulink. ModelAdvisor object | Handle to Simulink. ModelAdvisor object | The Model Advisor object you are working on. |
These properties interact the same way for tasks as for checks (see How Visible, Enable, and Value Properties Interact).
You can specify where the Model Advisor places tasks within the Model Advisor tree using the following guidelines.
To place a task in a new folder in the Model Advisor Task Manager, use the ModelAdvisor.Group class. See Defining Custom Groups.
To place a task in a new folder in the By Task folder, use the ModelAdvisor.FactoryGroup class. See Defining Custom Groups.
The following is an example of a task definition function. This function defines three tasks. See Code Example: Group Definition for an example of placing these tasks into a custom group.
function defineTaskAdvisor
mdladvRoot = ModelAdvisor.Root;
MAT1 = ModelAdvisor.Task('com.mathworks.sample.TaskSample1');
MAT1.DisplayName='Example task with input parameter and auto-fix ability';
MAT1.setCheck('com.mathworks.sample.Check1');
mdladvRoot.register(MAT1);
MAT2 = ModelAdvisor.Task('com.mathworks.sample.TaskSample2');
MAT2.DisplayName='Example task 2';
MAT2.setCheck('com.mathworks.sample.Check2');
mdladvRoot.register(MAT2);
MAT3 = ModelAdvisor.Task('com.mathworks.sample.TaskSample3');
MAT3.DisplayName='Example task 3';
MAT3.setCheck('com.mathworks.sample.Check3');
mdladvRoot.register(MAT3);
![]() | Defining Check Actions | Defining Custom Groups | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |