setCallbackFcn

Class: ModelAdvisor.Check
Package: ModelAdvisor

Specify callback function for check

Syntax

setCallbackFcn(check_obj, @handle, context, style)

Description

setCallbackFcn(check_obj, @handle, context, style) specifies the callback function to use with the check, check_obj.

Input Arguments

check_obj

Instantiation of the ModelAdvisor.Check class

handle

Handle to a check callback function

context

Context for checking the model or subsystem:

  • 'None' — No special requirements.

  • 'PostCompile' — The model must be compiled.

style

Type of callback function:

  • 'StyleOne' — Simple check callback function, for formatting results using template

  • 'StyleTwo' — Detailed check callback function

  • 'StyleThree' — Check callback functions with hyperlinked results

  • 'DetailStyle' — Check callback function for result collections. This style is recommended for authoring Model Advisor checks.

Examples

This example illustrates the definition for a check using a callback function whose style is defined as DetailStyle.

% This is the recommended style to author checks. 
function defineModelAdvisorChecks
mdladvRoot = ModelAdvisor.Root;
rec = ModelAdvisor.Check('com.mathworks.sample.Check0');
rec.Title = 'Check whether block names appear below blocks (recommended check style)';
rec.TitleTips = 'Example new style callback (recommended check style)';
rec.setCallbackFcn(@SampleNewCheckStyleCallback,'None','DetailStyle');
% set fix operation
myAction0 = ModelAdvisor.Action;
myAction0.setCallbackFcn(@sampleActionCB0);
myAction0.Name='Make block names appear below blocks';
myAction0.Description='Click the button to place block names below blocks';
rec.setAction(myAction0);
mdladvRoot.publish(rec, 'Demo'); % publish check into Demo group.