Main Content

Advisor.authoring.CustomCheck.checkCallback

注册检查回调以进行模型配置检查

语法

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

说明

注册使用 XML 数据文件指定检查行为的自定义检查时,Advisor.authoring.CustomCheck.checkCallback(system, CheckObj) 用作检查回调函数。

示例

在以下示例中,sl_customization.m 文件使用 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