User`s guide
26 Create Custom Configurations by Organizing Checks and Folders
26-20
Model Advisor Code Examples
In this section...
“Register Custom Tasks and Folders” on page 26-20
“Task Definition Function” on page 26-20
“Group Definition” on page 26-21
Register Custom Tasks and Folders
The following code example registers custom tasks and folders:
function sl_customization(cm)
% register custom factory group
cm.addModelAdvisorTaskFcn(@defineModelAdvisorTasks);
% register custom tasks.
cm.addModelAdvisorTaskAdvisorFcn(@defineTaskAdvisor);
Note: If you add custom checks and process callbacks within the sl_customization.m
file, include methods for registering the checks and process callbacks in the
sl_customization function. For more information, see “Register Checks and Process
Callbacks”.
Task Definition Function
The following is an example of a task definition function. This function defines three
tasks. The tasks are derived from the checks defined in “Check Definition Function”.
For an example of placing these tasks into a custom group, see “Group Definition” on
page 26-21.
% Defines Model Advisor tasks and a custom folder
% Add checks to a custom folder using task definitions
function defineTaskAdvisor
mdladvRoot = ModelAdvisor.Root;
% Define task that uses Sample Check 1: Informational check
MAT1 = ModelAdvisor.Task('mathworks.example.task.configManagement');
MAT1.DisplayName = 'Informational check for model configuration management';
MAT1.Description = 'Display model configuration and checksum information.';
setCheck(MAT1, 'mathworks.example.configManagement');