Documentation

Byte Unpacking

Deconstruct data frames

  • Library:
  • Utilities

Description

This block converts a vector of varying data types into one or more signals of user-selectable data types. The input of this block typically connects to an output port of a Receive block.

For example, suppose you are unpacking a uint8 vector signal into three signals. The signals have the following attributes:

DimensionSizeType
Scalar1single
Vector3uint8
Vector3uint8

  1. Set the output port data type to:

    {'single', ['uint8'], ['uint8']}

    Use square brackets to represent vectors.

  2. Set the output port dimension to:

    {[1],[3],[3]}
  3. Set the alignment value to 1.

  4. Connect the output signals to the Byte Unpacking block.

Ports

Input

expand all

The block displays one input port that receives a vector of packed data. The data type of the packed data is determined by inheritance from the source of the packed data.

Data Types: single | double | int8 | uint8 | int16 | uint16 | int32 | uint32 | Boolean

Output

expand all

The block displays from 1 to N output ports, as specified by elements of the cell array in the parameter Output port (unpacked) data types (cell array).

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Parameters

expand all

Specify as a cell array the data types of the output ports (unpacked) for the different output signals. The number of elements in the cell array determines the number of output ports shown by this block instance. Use square brackets in the cell array to represent vector elements.

Specify the dimensions of the output ports as a cell array of vectors.

Each element in the output signals list starts at a multiple of the alignment value, specified from the start of the input vector. If the alignment value is larger than the size of the data type in bytes, the vector contains pad bytes of value 0 to fill the space.

For example, if the alignment value is 4, a uint32 receives no padding, a uint16 receives 2 bytes of padding, and a uint8 receives 3 bytes of padding.

See Also

Introduced in R2006a

Was this topic helpful?