Byte Unpacking

Deconstruct data frames

  • Library:
  • Simulink Real-Time / 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.

Note

The Byte Packing block and Byte Unpacking block support the slrt.tlc code generation target and generate code that runs on Speedgoat target machines. Due to considerations such as endianness and addressable word size, these blocks can generate incorrect results for other code generation targets or target computers.

For example, suppose that 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 source of the packed data determines by inheritance the data type 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. To represent vector elements, use square brackets in the cell array.

Programmatic Use

Block Parameter: MaskUnpackedDataTypes

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

Programmatic Use

Block Parameter: MaskUnpackedDataSizes

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.

For example, if the alignment value is 4:

  • uint32 receives no padding

  • uint16 receives 2 bytes of padding

  • uint8 receives 3 bytes of padding

Programmatic Use

Block Parameter: MaskAlignment

See Also

Introduced in R2006a