Main Content

fixed.extractNumericType

Extract numeric type from input

Since R2021a

Description

example

T = fixed.extractNumericType(x) returns an embedded.numerictype object that is extracted from a numeric value input x, or is specified by the input argument x.

Examples

collapse all

Extract the numeric type from an input numeric value.

T = fixed.extractNumericType(pi)
T =


          DataTypeMode: Double
T = fixed.extractNumericType(int8(0))
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 8
        FractionLength: 0
T = fixed.extractNumericType(fi(pi,1,24,12))
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 24
        FractionLength: 12
T = fixed.extractNumericType(half(pi))
T =


          DataTypeMode: Half

Extract the numeric type from a numeric type specification object.

T = fixed.extractNumericType(numerictype(1,32,16))
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 32
        FractionLength: 16
T = fixed.extractNumericType(fixdt(0,18,0))
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 18
        FractionLength: 0

Extract the numeric type from a data type name string.

T = fixed.extractNumericType('int8')
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 8
        FractionLength: 0
T = fixed.extractNumericType('sfix16_En3')
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 3

Extract the numeric type from a constructor string.

T = fixed.extractNumericType('numerictype(1,33,55)')
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 33
        FractionLength: 55
T = fixed.extractNumericType('fixdt(0,77,22)')
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 77
        FractionLength: 22

Input Arguments

collapse all

Input, specified as a scalar.

The following input types are supported:

  • Numeric values — half, single, double, int8, int16, int32, int64, uint8, uint16, uint32, uint64, logical, fi

  • Numeric type specification objects — embedded.numerictype objects, Simulink.NumericType objects

  • MATLAB® data type name strings — 'half', 'single', 'double', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'logical'

  • Simulink® data type name strings (not aliases) — 'bool', 'sfix16_En3', etc.

  • Constructor strings that evaluate to a numeric type object — 'numerictype(1,33,55)', 'fixdt(0,77,22)', etc.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi
Complex Number Support: Yes

Output Arguments

collapse all

Numeric type of the input, returned as a embedded.numerictype object.

Version History

Introduced in R2021a