Documentation

addGroup

Class: ModelAdvisor.Group
Package: ModelAdvisor

Add subfolder to folder

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
Was this topic helpful?