Main Content

Advisor.authoring.CustomCheck.checkCallback

Register check callback for model configuration check

Syntax

Advisor.authoring.CustomCheck.checkCallback(system, CheckObj)

Description

Advisor.authoring.CustomCheck.checkCallback(system, CheckObj) is used as the check callback function when registering custom checks that use an XML data file to specify check behavior.

Examples

In the following example, the sl_customization.m file registers a configuration parameter check using Advisor.authoring.CustomCheck.checkCallback(system).

function defineModelAdvisorChecks
    
    rec = ModelAdvisor.Check('com.mathworks.Check1');
    rec.Title = 'Test: Check1';
    rec.setCallbackFcn(@(system)(Advisor.authoring.CustomCheck.checkCallback(system)), …
            'None', 'StyleOne');
    rec.TitleTips = 'Example check for check authoring infrastructure.';
    
    % --- data file input parameters
    rec.setInputParametersLayoutGrid([1 1]);
    inputParam1 = ModelAdvisor.InputParameter;
    inputParam1.Name = 'Data File';
    inputParam1.Value = 'Check1.xml';
    inputParam1.Type = 'String';
    inputParam1.Description = 'Name or full path of XML data file.';
    inputParam1.setRowSpan([1 1]);
    inputParam1.setColSpan([1 1]);
    rec.setInputParameters({inputParam1});

    % -- set fix operation
    act = ModelAdvisor.Action; 
    act.setCallbackFcn(@(task)(Advisor.authoring.CustomCheck.actionCallback(task)));
    act.Name = 'Modify Settings';
    act.Description = 'Modify model configuration settings.';
    rec.setAction(act);
    
    mdladvRoot = ModelAdvisor.Root;
    mdladvRoot.register(rec);
end