Unpack Data

Unpack an array of bytes into an array of integers


out = unpackData(in,datatype,datasize)


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


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.


Unpackaging data corresponding to an array of two int8 integers

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


out = [255 254]

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

Result: integers = [-127 127]

See Also

Unpack Data