Contenido principal

fixed.DataSpecification

R2026b

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

Description

dataspec = fixed.DataSpecification(numerictype) creates a DataSpecification object with data type specified by numerictype and default property values.

example

dataspec = fixed.DataSpecification(numerictype,propertyName=propertyValue)specifies additional properties using one or more property name-value arguments. For example, to generate complex data, set Complexity to complex.

example

Input Arguments

expand all

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

expand all

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. After construction, this property uses the notation described in Fixed-Point Data Type and Scaling Notation.

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 numerictype.

Example: dataspec.Intervals = {-1,1};

Example: dataspec.Intervals = fixed.Interval(-1,1);

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

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

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 of the generated data, specified as either 'real' or 'complex'.

Example: dataspec.Complexity = 'complex';

Data Types: char | string

Dimension of the generated data, specified as a positive scalar integer or row vector of positive integers.

Example: dataspec.Dimensions = 3;

Object Functions

containsDetermine whether value domain of a DataSpecification object contains a specified value
applyOnRootInport(To be removed) Apply properties to Inport block

Examples

collapse all

Create a fixed.DataSpecification object with default property values and an int16 data type. The returned Intervals property is [-32768,32767], which is equal to the representable range of the int16 data type.

dataspec = fixed.DataSpecification('int16')
dataspec = 

  fixed.DataSpecification with properties:

          DataTypeStr: 'int16'
            Intervals: [-32768,32767]
      MandatoryValues: <empty>
           Complexity: 'real'
           Dimensions: 1

Create a DataSpecification object with a data type of fixdt(1,16,10) and a range of - π to π .

interval = fixed.Interval(-pi,pi);
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

To include NaN and Inf values in the generated data, specify these values as intervals in the Interval object.

dataspec = fixed.DataSpecification('single',...
Intervals={{-Inf},{Inf},{NaN},{-pi,pi}})
dataspec = 

  fixed.DataSpecification with properties:

          DataTypeStr: 'single'
            Intervals: [-Inf] [-3.1416,3.1416] [Inf] [NaN]
     ExcludeDenormals: false
  ExcludeNegativeZero: false
      MandatoryValues: <empty>
           Complexity: 'real'
           Dimensions: 1

Version History

Introduced in R2019b