| Contents | Index |
This class enables you to create workspace objects that you can then use as the values of block parameters, (for example, the value of the Gain parameter of a Gain block. 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 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, or its minimum and maximum values. Some Simulink products use this information. For example, Simulink and Simulink Coder products use information specified by Simulink.Parameter objects to determine whether the parameter is tunable (see Using Tunable Parameters).
Simulink performs range checking of parameter values. The software alerts you when the parameter object value lies outside a range that corresponds to its specified minimum and maximum values and data type.
You can use the Simulink.Parameter dialog box to define a Simulink.Parameter object. To open the dialog box, in the Model Explorer, select the base workspace or a model workspace and select Add > Simulink Parameter.

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.
| Expression | Description |
|---|---|
| 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. |
| struct('A',20,'B',5) | Specifies a structure for a bus with two signals, A and B, with double-precision values of 20 and 5, respectively. The shape and attributes of the structure must match the shape and attributes of the elements in the bus. For information about specifying an initial condition structure, see Specifying Initial Conditions for Bus Signals. |
Note Specifying a typed expression as the Value property of the parameter object overrides the current setting of the Data type property. |
If Value evaluates to a MATLAB structure, then in the Configuration Parameters > Diagnostics > Data Validity pane, set Underspecified initialization detection to simplified.
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:
A built-in data type that Simulink supports (see Data Types Supported by Simulink ).
A Simulink.NumericType object
A Simulink.AliasType object
A Simulink.Bus object (using the Bus: <object name> option)
You can use the Bus Editor to define or edit a Simulink.Parameter object with a bus object for its data type. Use one of these approaches:
Select the File > Create/Edit a Simulink.Parameter object menu item.
Click the Create/Edit a Simulink.Parameter
object icon (
) from the toolbar.
You can then edit the Simulink.Parameter object in the MATLAB Editor and evaluate the code to create or update the values for this Simulink.Parameter object.
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.)
Measurement units in which this value is expressed (for example, inches). This field is intended for use in documenting this parameter. Simulink ignores it.
Dimensions of the parameter. Simulink determines the dimensions from the entry in the Value field of this parameter. You cannot set this field yourself.
Numeric type (i.e., real or complex) of the parameter. Simulink determines the numeric type of this parameter from the entry in the Value field of this parameter. You cannot set this field yourself.
Minimum value that the parameter can have. The default value is [] (unspecified). Specify a finite, real, double, scalar value.
Note If you specify a bus object as the data type for a parameter, do not set the minimum value for bus data on the parameter property dialog box. Simulink ignores this setting. Instead, set the minimum values for bus elements of the bus object specified as the data type. For information on the Minimum property of a bus element, see Simulink.BusElement. |
Simulink 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 value that the parameter can have. The default value is [] (unspecified). Specify a finite, real, double, scalar value.
Note If you specify a bus object as the data type for a parameter, do not set the maximum value for bus data on the parameter property dialog box. Simulink ignores this setting. Instead, set the maximum values for bus elements of the bus object specified as the data type. For information on the Maximum property of a bus element, see Simulink.BusElement. |
Simulink 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 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 Simulink Coder User's Guide for more information.
Alternate name for this parameter. Simulink ignores this setting.
Data alignment boundary, specified in number of bytes. The starting memory address for the data allocated for the parameter will be a multiple of the Alignment setting. The default value is -1, which specifies that the code generator should determine an optimal alignment based on usage. Otherwise, specify a positive integer that is a power of 2, not exceeding 128. This field is intended for use by Simulink Coder software (see Configure Data Alignment for Function Implementations in the Embedded Coder User's Guide) . Simulink software ignores this setting.
Description of this parameter. This field is intended for use in documenting this parameter. Simulink ignores it.
Name | Access | Description |
|---|---|---|
Value of this parameter. (Value) | ||
Information used by Simulink Coder software for generating code for this parameter. The value of this property is an object of Simulink.ParamCoderInfo class. | ||
Description | RW | String that describes this parameter. This property is intended for user use. Simulink itself does not use it. (Description) |
String specifying the data type of this parameter. (Data type) | ||
Minimum value that this parameter can have. (Minimum) | ||
Maximum value that this parameter can have. (Maximum) | ||
Measurement units in which this parameter's value is expressed. (Units) | ||
String specifying the numeric type of this parameter. Valid values are 'real' or 'complex'. (Complexity) | ||
Vector specifying the dimensions of this parameter. (Dimensions) |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |