Documentation Center

  • Trial Software
  • Product Updates

comm.BitToInteger System object

Package: comm

Convert vector of bits to vector of integers

Description

The BitToInteger object maps groups of bits in the input vector to integers in the output vector.

To map bits to integers:

  1. Define and set up your bit to integer object. See Construction.

  2. Call step to map groups of bits in the input vector to integers in the output vector according to the properties of comm.BitToInteger. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.BitToInteger creates a bit-to-integer converter System object™, H, that maps a vector of bits to a corresponding vector of integer values.

H = comm.BitToInteger(Name,Value) creates a bit-to-integer converter object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

H = comm.BitToInteger(NUMBITS,Name,Value) creates a bit-to-integer converter System object, H This object has the BitsPerInteger property set to NUMBITS and the other specified properties set to the specified values.

Properties

BitsPerInteger

Number of bits per integer

Specify the number of input bits that the object maps to each output integer. You can set this property to a scalar integer between 1 and 32. The default is 3.

MSBFirst

Assume first bit of input bit words is most significant bit

Set this property to true to indicate that the first bit of the input bit words is the most significant bit (MSB). The default is true. You can set this property to false to indicate that the first bit of the input bit words is the least significant bit (LSB).

SignedIntegerOutput

Output signed integers

Set this property to true to generate signed integer outputs. The default is false. You can set this property to false to generate unsigned integer outputs.

When you set this property to false, the output values are integers between 0 and (2N) –1. In this case, N is the value you specified in the BitsPerInteger property.

When you set this property to true, the output values are integers between -(2(N-1)) and (2(N –1)) –1.

OutputDataType

Data type of output

Specify the output data type. The default is Full precision.

When you set the SignedIntegerOutput property to false, set this property as one of Full precision | Smallest integer | Same as input | double | single | int8 | uint8 | int16 | uint16 | int32 | uint32.

When you set this property to Same as input, and the input data type is numeric or fixed-point (fi object), the output data has the same type as the input data.

When the input signal is an integer data type, you must have a Fixed-Point Designer™ user license to use this property in Smallest unsigned integer or Full precision mode.

When you set the SignedIntegerOutput property to true, specify the output data type as one of Full precision | Smallest integer | double | single | int8 | int16 | int32.

When you set this property to Full precision, the object determines the output data type based on the input data type. If the input data type is double or single precision, the output data has the same type as the input data. Otherwise, the property determines the output data type in the same way as when you set this property to Smallest unsigned integer.

Methods

cloneCreate bit to integer converter object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepConvert vector of bits to vector of integers

Examples

expand all

Convert random 4-bit words to integers

 hBitToInt = comm.BitToInteger(4);
% Generate three 4-bit words
  bitData = randi([0 1],3*hBitToInt.BitsPerInteger,1);
  intData = step(hBitToInt,bitData)
intData =

    13
     9
    13

Algorithms

This object implements the algorithm, inputs, and outputs described on the Bit To Integer Converter block reference page. The object properties correspond to the block parameters.

See Also

| |

Was this topic helpful?