Simulink.Parameter

Specify value, value range, data type, and other properties of block parameter

Description

This class enables you to create workspace objects that you can then use as the values of block parameters, e.g., the value of a Gain block's Gain parameter. You can create a Simulink.Parameter object in the base MATLAB workspace or a model workspace. However, to create the object in a model workspace, you must set the object's storage class to Auto.

Parameter objects let you specify not only the value of a parameter but also other information about the parameter, such as the parameter's purpose, its dimensions, its minimum and maximum values, etc. Some Simulink products use this information. For example, Simulink and Real-Time Workshop products use information specified by Simulink.Parameter objects to determine whether the parameter is tunable (see Changing the Values of Block Parameters During Simulation).

The Simulink software performs range checking of parameter values. The software alerts you when the parameter object's value lies outside a range that corresponds to its specified minimum and maximum values and data type.

Property Dialog Box

Value

Value of the parameter. You can use MATLAB expressions to specify the numeric type, dimensions, and data type of the parameter (see Data Types Supported by Simulink® ). You can also specify fixed-point values for block parameters (see Specifying Fixed-Point Values Directly in the Simulink Fixed Point documentation). The following examples illustrate this syntax.

ExpressionDescription
single(1.0)

Specifies a single-precision value of 1.0

int8(2)

Specifies an 8-bit integer of value 2

int32(3+2i)

Specifies a complex value whose real and imaginary parts are 32-bit integers

fi(2.3,true,16,3)

Specifies a signed fixed-point numeric object having a value of 2.3, a word length of 16 bits, and a fraction length of 3.

Data type

Data type of the parameter. You can either select a data type from the adjacent pulldown menu or enter a string. If you select auto (the default), the block that references the parameter object determines the data type of the variable used to represent this parameter in code generated from the model. If you enter a string, it must evaluate to one of the following:

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Data type parameter. (See Using the Data Type Assistant.)

Units

Measurement units in which this value is expressed, e.g., inches. This field is intended for use in documenting this parameter. Simulink software ignores it.

Dimensions

Dimensions of the parameter. Simulink software determines the dimensions from the entry in the Value field of this parameter. You cannot set this field yourself.

Complexity

Numeric type (i.e., real or complex) of the parameter. Simulink software determines the numeric type of this parameter from the entry in the Value field of this parameter. You cannot set this field yourself.

Minimum

Minimum value that the parameter can have. Specify a value that evaluates to a scalar, real number with double data type. The Simulink software generates a warning if the parameter value is less than the minimum value or if the minimum value is outside the range of the parameter data type. When updating the diagram or starting a simulation, Simulink generates an error in these cases.

Maximum

Maximum value that the parameter can have. Specify a value that evaluates to a scalar, real number with double data type. The Simulink software generates a warning if the parameter value is greater than the maximum value or if the maximum value is outside the range of the parameter data type. When updating the diagram or starting a simulation, Simulink generates an error in these cases.

Storage class

Storage class of this parameter. Simulink code generation products use this property to allocate memory for this parameter in generate code. See Tunable Parameter Storage Classes in Real-Time Workshop® User's Guide for more information.

Alias

Alternate name for this parameter. Simulink software ignores this setting.

Description

Description of this parameter. This field is intended for use in documenting this parameter. Simulink software ignores it.

Properties

Name

Access

Description

Value

RW

Value of this parameter. (Value)

DataType

RW

String specifying the data type of this parameter. (Data type)

Dimensions

RO

Vector specifying the dimensions of this parameter. (Dimensions)

Complexity

RO

String specifying the numeric type of this parameter. Valid values are 'real' or 'complex'. (Complexity)

Min

RW

Minimum value that this parameter can have. (Minimum)

Max

RW

Maximum value that this parameter can have. (Maximum)

DocUnits

RW

Measurement units in which this parameter's value is expressed. (Units)

RTWInfo

RW

Information used by Real-Time Workshop software for generating code for this parameter. The value of this property is an object of Simulink.ParamRTWInfo class.

Description

RW

String that describes this parameter. This property is intended for user use. Simulink software itself does not use it. (Description)

  


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