fixed.DataSpecification
Specify properties of data to generate
Description
Use the fixed.DataSpecification
and fixed.DataGenerator
objects to generate simulation inputs to test the full
operating range of your designs.
Creation
Syntax
Description
creates a dataspec
= fixed.DataSpecification(numerictype
)DataSpecification
object with default property values and data
type specified by numerictype
.
creates
a dataspec
= fixed.DataSpecification(numerictype
,Name,Value
)DataSpecification
object with data type specified by
numerictype
, and additional properties specified as
Name,Value
pair arguments.
Input Arguments
numerictype
— Data type of generated data
character vector | Simulink.NumericType
object | embedded.numerictype
object
Data type of the generated data, specified as a string or character vector that
evaluates to a numeric data type, or as a Simulink.NumericType
or numerictype
object.
Example:
dataspec = fixed.DataSpecification('double')
Example:
dataspec = fixed.DataSpecification('fixdt(1,16,4)')
Example:
dataspec = fixed.DataSpecification(Simulink.NumericType);
Properties
DataTypeStr
— Data type of generated data
character vector | Simulink.NumericType
object | embedded.numerictype
object
Data type of the generated data, specified as a string or character vector that
evaluates to a numeric data type, or as a Simulink.NumericType
or numerictype
object.
This property cannot be edited after construction.
Intervals
— Intervals within which to generate numeric data
fixed.Interval
object | array of fixed.Interval
objects | cell array containing inputs to fixed.Interval
constructor
Numeric intervals in which to generate numeric data, specified as a fixed.Interval
object, an array of fixed.Interval
objects, or a cell array containing inputs to the fixed.Interval
constructor.
If you do not specify an interval, the default interval uses end points equal to the minimum and maximum representable values of the specified numeric type.
Example:
dataspec.Intervals = {-1,1};
Example:
dataspec.Intervals = fixed.Interval(-1,1);
ExcludeDenormals
— Whether to exclude denormal numbers from generated data
false (default) | true
Whether to exclude denormal numbers from generated data, specified as a logical.
This property is only applicable when the DataTypeStr
property
is a floating-point type.
Data Types: logical
ExcludeNegativeZero
— Whether to exclude negative zero from generated data
false (default) | true
Whether to exclude negative zero from generated data, specified as a logical.
This property is only applicable when the DataTypeStr
property
is a floating-point type.
Data Types: logical
MandatoryValues
— Values to include in the generated data
<empty>
(default) | scalar | vector | matrix | multidimensional array
Values to include in the generated data, specified as a scalar, vector, matrix, or
multidimensional array. If the values specified in MandatoryValues
are outside the range of the data type specified in DataTypeStr
,
the values are saturated to the nearest representable value.
Example: dataspec.MandatoryValues = [-215, 216];
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| fi
Complexity
— Complexity of generated data
'real'
(default) | 'complex'
Complexity of the generated data, specified as either 'real'
or
'complex'
.
Example: dataspec.Complexity = 'complex';
Data Types: char
| string
Dimensions
— Dimension of the generated data
1 (default) | positive scalar integer | row vector of positive integers
Dimension of the generated data, specified as a positive scalar integer or row vector of positive integers.
Example:
dataspec.Dimensions = 3;
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Object Functions
contains | Determine whether value domain of a DataSpecification object
contains a specified value |
applyOnRootInport | (To be removed) Apply properties to Inport block |
Examples
Create a fixed.DataSpecification
Object
Create a fixed.DataSpecification
object with default property values and an int16 data type.
dataspec = fixed.DataSpecification('int16')
dataspec = fixed.DataSpecification with properties: DataTypeStr: 'int16' Intervals: [-32768,32767] MandatoryValues: <empty> Complexity: 'real' Dimensions: 1
The default interval of the DataSpecification
object is equal to the range of the data type specified in the constructor.
Create a fixed.DataSpecification
Object from a fixed.Interval
Object
Create a fixed.Interval
object specifying a range of - to .
interval = fixed.Interval(-pi,pi)
interval = [-3.1416,3.1416] 1x1 fixed.Interval with properties: LeftEnd: -3.1416 RightEnd: 3.1416 IsLeftClosed: true IsRightClosed: true
Create a DataSpecification
object using this interval and a data type of fixdt(1,16,10)
.
dataspec = fixed.DataSpecification('fixdt(1,16,10)',... 'Intervals',interval)
dataspec = fixed.DataSpecification with properties: DataTypeStr: 'sfix16_En10' Intervals: [-3.1416,3.1416] MandatoryValues: <empty> Complexity: 'real' Dimensions: 1
Alternatively, you can specify the interval as a cell array of inputs to the fixed.Interval
constructor. The following code generates an equivalent DataSpecification
object.
dataspec = fixed.DataSpecification('fixdt(1,16,10)',... 'Intervals',{-pi,pi})
dataspec = fixed.DataSpecification with properties: DataTypeStr: 'sfix16_En10' Intervals: [-3.1416,3.1416] MandatoryValues: <empty> Complexity: 'real' Dimensions: 1
Create a DataSpecification
object that includes NaN and Inf
You can include NaN and Inf values in the generated data by
specifying these values as intervals in an Interval
object.
The following code creates a DataSpecification
object that
references an array of interval objects that include the values -Inf, Inf, NaN, and the
range [-1, 1].
dataspec = fixed.DataSpecification('single', 'Intervals',... {{-Inf}, {Inf}, {NaN}, {-1,1}})
dataspec = fixed.DataSpecification with properties: DataTypeStr: 'single' Intervals: [-Inf] [-1,1] [Inf] [NaN] ExcludeDenormals: false ExcludeNegativeZero: false MandatoryValues: <empty> Complexity: 'real' Dimensions: 1
Version History
Introduced in R2019b
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)