UDP Pack

Binary byte packing of input data into a single output vector (not recommended)


Simulink® Real-Time™ Library of Drivers No Longer Recommended for Use


The Pack block is used to convert one or more Simulink signals of varying data types to a single vector of uint8 as required by the Send block.

    Note:   The UDP Pack block will be removed in a future release. Use the Byte Packing block instead.

Block Parameters

Input port data types

Specify the data types for the different signals as part of the block parameters. The supported data types are double, single, int8, uint8, int16, uint16, int32, uint32, and boolean. The block determines the sizes of the signals automatically. This parameter is usually the same as the Output port data types parameter of the corresponding UDP Unpack block.

Byte alignment

The byte alignment field specifies how the data types are aligned. The possible values are: 1, 2, 4, and 8. The byte alignment scheme is simple, and starts each element in the list of signals on a boundary specified by the alignment relative to the start of the vector.


The data types of each of the signals must be specified as a cell array of character vectors in the required order. Once this is done, the block automatically converts itself to one with the corresponding number of input ports. There is one output port. For example, say the input port data types are specified as


and an alignment of 4 is used. Assume also that the signals are scalars. The first signal then starts at byte 0, the second at byte 4, the third at byte 8, the fourth at byte 12, and the fifth at byte 16. Note that the sizes of the data types used in this example are 1, 4, 4, 2, and 8 bytes respectively. This implies that there are "holes" of 3 bytes between the first and second signal and 2 bytes between the fourth and fifth signal.

A byte alignment of 1 means the tightest possible packing. That is, there are no holes for arbitrary combinations of signals and data types.

    Note:   Individual elements of vector/matrix signals are not byte aligned; only the entire vector/matrix is byte aligned. The individual elements are tightly packed with respect to the first element.

See Also

UDP Unpack

UDP Send

Was this topic helpful?