Defining Custom Groups

About Custom Groups

Groups are used to consolidate checks in the Model Advisor by functionality or usage. You define custom groups in

You must define one instance of the group classes for each grouping that you want to add to the Model Advisor, and register the custom group as described in Registering Custom Checks, Tasks, and Groups. The sections that follow describe how to define custom groups.

Defining Where Custom Groups Appear

You can specify where custom groups are placed within the Model Advisor tree using the following guidelines:

Properties of Model Advisor Groups

The following table describes the properties of the ModelAdvisor.Group and ModelAdvisor.FactoryGroup classes:

PropertyData TypeDefault ValueDescription
DisplayNameString'' (null string)Name of the group as it should appear in Model Advisor.
IDStringYou must provide IDPermanent, unique identifier for the group that you must specify.

    Caution  

    • The value of ID must remain constant.

    • The Model Advisor generates an error if ID is not unique.

    • Groups should refer to other groups by ID.

DescriptionString'' (null string)Description of the group, which Model Advisor displays in the right pane when you view details about the group.
MAObjSimulink.
ModelAdvisor
object
Handle to Simulink.
ModelAdvisor
object
The Model Advisor object you are working on.

Code Example: Group Definition

The following is an example of a group definition that places the tasks defined in Code Example: Task Definition Function inside a folder called My Group under the Model Advisor Task Manager folder. This group definition is included in the task definition function.

MAG = ModelAdvisor.Group('com.mathworks.sample.GroupSample');
MAG.DisplayName='My Group';
MAG.addTask(MAT1);
MAG.addTask(MAT2);
MAG.addTask(MAT3);
mdladvRoot.publish(MAG); % publish under Model Advisor Task Manager

The following is an example of a factory group definition function that places the checks defined in Code Example: Check Definition Function into a folder called Demo Factory Group inside of the By Task folder.

function defineModelAdvisorTasks
mdladvRoot = ModelAdvisor.Root;

% --- sample factory group
rec = ModelAdvisor.FactoryGroup('com.mathworks.sample.factorygroup');
rec.DisplayName='Demo Factory Group';
rec.Description='Demo Factory Group';
rec.addCheck('com.mathworks.sample.Check1');
rec.addCheck('com.mathworks.sample.Check2');
rec.addCheck('com.mathworks.sample.Check3');
mdladvRoot.publish(rec); % publish inside By Task
  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS