Defining Check Input Parameters

About Input Parameters

Input parameters allow you to request input from the user for a Model Advisor check. You define input parameters using the ModelAdvisor.InputParameter class inside a custom check function (see Defining Custom Checks). You must define one instance of this class for each input parameter that you want to add to a Model Advisor check.

Properties of Input Parameters

The following table describes the properties of the ModelAdvisor.InputParameter class:

PropertyData TypeDefault ValueDescription
NameString'' (null string)Name of the input parameter as it should appear in the custom check.
TypeEnumeration'' (null string)Type of input parameter. Used with Value or Entries to define input parameters. See the following table for details.
ValueDepends on Type. See following table.Depends on Type. See following table.Value of the input parameter. This property is valid only when the Type is Bool, String, Enum, or ComboBox. See following table.
EntriesDepends on Type. See following table.Depends on Type. See following table.This property is valid only when the Type is Enum, ComboBox, or PushButton. See following table.
DescriptionString'' (null string)Description of the parameter, which the Model Advisor displays in the right pane when you view details about the check.

Types of Input Parameters

TypeData TypeDefault ValueDescription
BoolBooleanfalseA check box.
StringString'' (null string)A text box.
EnumCell arrayFirst entry in the menuA drop-down menu.
  • Use Entries to define the entries in the menu.

  • Use Value to indicate a specific entry in the menu.

ComboBoxCell arrayFirst entry in the menuA drop-down menu that allows the user to type in a value or choose a value from the menu.
  • Use Entries to define the entries in the menu.

  • Use Value to indicate a specific entry in the menu or to enter a value not in the menu.

PushButtonN/AN/A

A button.

When you click the button, the callback function specified by Entries is called.

Specifying Input Parameter Layout

You can specify the layout of input parameters in the right pane of the Model Advisor window in an input parameter definition. Use the following methods to place input parameters.

See the ModelAdvisor.Check and ModelAdvisor.InputParameter class references for information on using these methods.

Code Example: Input Parameter Definition

The following is an example of defining input parameters to add to a custom check. You must include input parameter definitions inside a custom check definition (see Code Example: Check Definition Function). The following code, when included in a custom check definition, creates three input parameters.

rec = ModelAdvisor.Check('com.mathworks.sample.Check1');
rec.setInputParametersLayoutGrid([3 2]);
% define input parameters
inputParam1 = ModelAdvisor.InputParameter;
inputParam1.Name = 'Skip font checks.';
inputParam1.Type = 'Bool';
inputParam1.Value = false;
inputParam1.Description = 'sample tooltip';
inputParam1.setRowSpan([1 1]);
inputParam1.setColSpan([1 1]);
inputParam2 = ModelAdvisor.InputParameter;
inputParam2.Name = 'Standard font size';
inputParam2.Value='12';
inputParam2.Type='String';
inputParam2.Description='sample tooltip';
inputParam2.setRowSpan([2 2]);
inputParam2.setColSpan([1 1]);
inputParam3 = ModelAdvisor.InputParameter;
inputParam3.Name='Valid font';
inputParam3.Type='Combobox';
inputParam3.Description='sample tooltip';
inputParam3.Entries={'Arial', 'Arial Black'};
inputParam3.setRowSpan([2 2]);
inputParam3.setColSpan([2 2]);
rec.setInputParameters({inputParam1,inputParam2,inputParam3});

The Model Advisor displays these input parameters in an Input Parameters box in the right pane.

  


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