Main Content

ModelAdvisor.Check.setCallbackFcn

R2026b

Specify callback function for check

Description

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

Examples

collapse all

This example shows how to define a check using a callback function whose style is defined as DetailStyle.

Create and configure Model Advisor check object.

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');

Create and assign an action object.

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);

Publish the check.

mdladvRoot.publish(rec, 'Demo');

Input Arguments

collapse all

Model Advisor check object, specified as a ModelAdvisor.Check object.

Specifies the callback function to execute when the check runs.

Example: @SampleNewCheckStyleCallback

Specifies when the callback function should be executed during the model checking process.

context ValueDefinition
'None'Does not require any special context for compilation.
'PostCompile'Requires the model to be compiled.
'PostCompileForCodegen'Requires the model to be compiled for code generation without simulation. Use this option to check if the model is ready for code generation and to analyze both active and inactive variant paths. To analyze all variant paths, set the System target file configuration parameter to ert.tlc.

Example: 'PostCompile'

Specifies the style of the callback function to determine how the check's results are displayed in the Model Advisor.

style ValueDefinition
'StyleOne'Uses a simple check callback function with results formatted using a template.
'StyleTwo'Uses a detailed check callback function for more comprehensive result reporting.
'StyleThree'Uses a check callback function that includes hyperlinked results for easier navigation.
'DetailStyle'Uses a callback function designed for result collections. This style is recommended for creating custom Model Advisor checks.

Example: 'StyleTwo'

Version History

Introduced in R2008a