Main Content

Advisor.authoring.CustomCheck.actionCallback

Register action callback for model configuration check

Syntax

Advisor.authoring.CustomCheck.actionCallback(task)

Description

Advisor.authoring.CustomCheck.actionCallback(task) is used as the action callback function when registering custom checks that use an XML data file to specify check behavior.

Examples

This sl_customization.m file registers the action callback for configuration parameter checks with fix actions.

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