ModelAdvisor.Check - Create custom checks

Class Description

The ModelAdvisor.Check class creates a Model Advisor check object. All checks must have an associated ModelAdvisor.Task or ModelAdvisor.Root object to appear in the Model Advisor tree.

You can use one ModelAdvisor.Check object in multiple ModelAdvisor.Task objects, allowing you to place the same check in multiple locations in the Model Advisor tree. For example, Check for implicit signal resolution appears in the By Product > Simulink folder and in the By Task > Model Referencing folder in the Model Advisor tree.

Syntax

check_obj = ModelAdvisor.Check(check_ID)

Arguments

check_obj

A variable representing the check object you create.

check_ID

A string that uniquely identifies the check. The value of check_ID must remain constant.

Method Summary

NameDescription
getIDReturns the check ID
setActionSpecify action
setCallbackFcnSpecify callback function
setInputParametersSpecify input parameters
setInputParametersLayoutGridSpecify layout grid for input parameters

Methods

getID

Purpose

Returns the check ID

Syntax

id = check_obj.getID

Arguments

check_obj

A variable representing the check object.

Return Values

id

A unique string identifying the check.

Description

The getID method returns a string that uniquely identifies the check. You create this unique identifier when you create the check. This is the equivalent of the ModelAdvisor.Check ID property.

See Also

Properties of Custom Checks

setAction

Purpose

Specify action

Syntax

check_obj.setAction(action_obj)

Arguments

check_obj

A variable representing the check object.

action_obj

The ModelAdvisor.Action object to use in the check.

Description

The setAction method identifies the action you want to use in a check.

See Also

ModelAdvisor.Action

setCallbackFcn

Purpose

Specify callback function

Syntax

check_obj.setCallbackFcn(@handle, context, style)

Arguments

check_obj

A variable representing the check object.

handle

A handle to a check callback function.

context

Context for checking the model or subsystem.

style

Type of callback function:

Description

Specify the callback function to use with the check object.

See Also

Creating Callback Functions for Checks

setInputParameters

Purpose

Specify input parameters

Syntax

check_obj.setInputParameters(params)

Arguments

check_obj

A variable representing the check object.

params

A cell array of ModelAdvisor.InputParameter objects.

Description

Specify the input parameters to use in a check object.

See Also

ModelAdvisor.InputParameter

setInputParametersLayoutGrid

Purpose

Specify layout grid for input parameters

Syntax

check_obj.setInputParametersLayoutGrid([row col])

Arguments

check_obj

A variable representing the check object.

row

Total number of rows in the layout grid.

col

Total number of columns in the layout grid.

Description

Specify the layout grid for input parameters in the Model Advisor. Use this method if there are multiple input parameters.

See Also

Example

See Demo and Code Example for more information.

%Define a check
rec = ModelAdvisor.Check('com.mathworks.sample.Check1');
rec.Title = 'Check Simulink block font';
rec.TitleTips = 'Example style three callback';
rec.setCallbackFcn(@SampleStyleThreeCallback,'None','StyleThree');

% Define input parameters
rec.setInputParametersLayoutGrid([3 2]);
inputParam1 = ModelAdvisor.InputParameter;
inputParam1.Name = 'Skip font checks.';
inputParam2.Name = 'Standard font size';
inputParam2 = ModelAdvisor.InputParameter;
inputParam3.Name='Valid font';
inputParam3 = ModelAdvisor.InputParameter;
rec.setInputParameters({inputParam1,inputParam2,inputParam3});

% define action (fix) operation
myAction = ModelAdvisor.Action;
rec.setAction(myAction);

See Also

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS