Unpack Data

Unpack an array of bytes into an array of integers

Syntax

out = unpackData(in,datatype,datasize)

Description

out = unpackData(in,datatype,datasize) unpacks an input array of uint8 bytes into integer data with the specified data type "datatype" and data size "datasize".

Data Type

Unpackaged integer output can be any of the following supported int data types:

*when uint8 is specified, the input is passed through

Size

Input data must be a 1-dimensional array. There is no limit to the length of the array.

Packaging Protocol

To find out how data is packaged, see the following Packaging Protocol documentation.

Code Generation

This function is supported for code generation. It can be be used in a Simulink model, deployed to a target, or converted into a standalone executable or mex file.

Example

Unpackaging data corresponding to an array of two int8 integers

>> bytes = packData([-127 127],'int8',2);

Result:

out = [255 254]

>> integers = unpackData(bytes,'int8',2);

Result: integers = [-127 127]

See Also

Unpack Data