Main Content

Byte Unpack

Unpack UDP uint8 input vector into Simulink data type values

Library

Embedded Coder/Embedded Targets//Host Communication

  • Byte Unpack block

Description

Byte Unpack is the inverse of the Byte Pack block. It takes a UDP message from a UDP receive block as a uint8 vector, and outputs Simulink® data types in various sizes depending on the input vector.

The block supports all Simulink data types.

Parameters

Output port dimensions (cell array)

Containing a cell array, each element in the array specifies the dimension that the MATLAB® size function returns for the corresponding signal. Usually you use the same dimensions as you set for the corresponding Byte Pack block in the model. Entering one value means that the block applies that dimension to all data types.

Output port data types (cell array)

Specify the data types for the different input signals to the Pack block. The block supports all Simulink data types—single, double, int8, uint8, int16, uint16, int32, and uint32, and Boolean. The entry here is the same as the Input port data types parameter in the Byte Pack block in the model. You can enter one data type and the block applies that type to all output ports.

Byte Alignment

This option specifies how to align the data types to form the input uint8 vector. Match this setting with the corresponding Byte Pack block alignment value of 1, 2, 4, or 8 bytes.

Example

This figure shows the Byte Unpack block that corresponds to the example in the Byte Pack example. The Output port data types (cell array) entry shown is the same as the Input port data types (cell array) entry in the Byte Pack block

{'uint32','uint32','uint16','double','uint8','double','single'}.

In addition, the Byte alignment setting matches as well. Output port dimensions (cell array) now includes scalar values and matrices to show how to enter nonscalar values. The example for the Byte Pack block assumed only scalar inputs.

Introduced in R2011a