Main Content

addGroup

Class: ModelAdvisor.Group
Namespace: ModelAdvisor

(Not recommended) Add subfolder to folder

The ModelAdvisor.Group class and its associated methods and properties are not recommended. Use the Model Advisor Configuration Editor or Advisor.Config API to customize the Model Advisor configuration. For more information, see Version History.

Syntax

addGroup(group_obj, child_obj)

Description

addGroup(group_obj, child_obj) adds a new subfolder, identified by child_obj, to the folder specified by group_obj, which is an instantiation of the ModelAdvisor.Group class.

Examples

Add three checks to rec:

group_obj = ModelAdvisor.Group('com.mathworks.sample.group');
.
.
.
addGroup(group_obj, 'com.mathworks.sample.subgroup1');
addGroup(group_obj, 'com.mathworks.sample.subgroup2');
addGroup(group_obj, 'com.mathworks.sample.subgroup3');

To add ModelAdvisor.Task objects to a group using addGroup:

mdladvRoot = ModelAdvisor.Root();

% MAT1, MAT2, and MAT3 are registered ModelAdvisor.Task objects
% Create the group 'My Group' 
MAG = ModelAdvisor.Group('com.mathworks.sample.GroupSample');
MAG.DisplayName='My Group';

% Add the first task to the 'My Group' folder
MAG.addTask(MAT1);								

% Create a subfolder 'Folder1'
MAGSUB1 = ModelAdvisor.Group('com.mathworks.sample.Folder1');		
MAGSUB1.DisplayName='Folder1';

% Add the second task to Folder1
MAGSUB1.addTask(MAT2);				
			
% Create a subfolder 'Folder2'
MAGSUB2 = ModelAdvisor.Group('com.mathworks.sample.Folder2');		
MAGSUB2.DisplayName='Folder2';

% Add the third task to Folder2
MAGSUB2.addTask(MAT3);							

% Register the two subfolders. This must be done before calling addGroup
mdladvRoot.register(MAGSUB1);	
mdladvRoot.register(MAGSUB2);

% Invoke addGroup to place the subfolders under 'My Group'
MAG.addGroup(MAGSUB1);	
MAG.addGroup(MAGSUB2);

mdladvRoot.publish(MAG); % publish under Root

Version History

collapse all

R2024b: Not recommended

Using the ModelAdvisor.Group class and its associated methods and properties to create custom folders is not recommended. Use the Model Advisor Configuration Editor or Advisor.Config API to customize the Model Advisor configuration. For more information, see Use Model Advisor Configuration Editor to Customize Model Advisor and Customize Model Advisor Configuration Programmatically.