Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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: ''

Introduced before R2006a

Was this topic helpful?