Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

ufrac

Create Simulink.NumericType object describing unsigned fractional data type

Syntax

a = ufrac(WordLength)
a = ufrac(WordLength, GuardBits)

Description

ufrac(WordLength) returns a Simulink.NumericType object that describes the data type of an unsigned fractional data type with a word size given by WordLength.

ufrac(WordLength, GuardBits) returns a Simulink.NumericType object that describes the data type of an unsigned fractional data type. The total word size is given by WordLength with GuardBits bits located to the left of the binary point.

    Note:   ufrac is a legacy function. In new coder, use fixdt instead. In existing code, replace ufrac(WordLength) with fixdt(0,WordLength,WordLength) and ufrac(WordLength,GuardBits) with fixdt(0,WordLength,(WordLength-GuardBits)).

Examples

Define an 8-bit unsigned fractional data type with 4 guard bits. Note that the range of this data type is from 0 to (1 - 2-8).24 = 15.9375.

a = ufrac(8,4)
a = 

  NumericType with properties:

      DataTypeMode: 'Fixed-point: binary point scaling'
        Signedness: 'Unsigned'
        WordLength: 8
    FractionLength: 4
           IsAlias: 0
         DataScope: 'Auto'
        HeaderFile: ''
       Description: ''

See Also

| | | | | | |

Was this topic helpful?