Version:

Last Modified: February 7, 2018

Packs data to an unsigned or signed integer array.

This node packs *MN*-sized binary data of the form *b* _{ i } = {0,1}, to an unsigned or signed integer array a_n,

where

*i*= 0…*MN*-1, and*M*denotes the number of bits per integer*n*= 0…*N*-1, and*N*denotes the size of the array

The binary bit stream to be packed into integers.

The binary bit stream must be in the form *b* _{ i } = {0,1}

where

*i*= 0…*MN*-1, and*M*denotes the number of bits per integer-
*n*= 0…*N*-1, and*N*denotes the size of the array

**Default: **empty

Number of binary data values that are packed into an integer.

If you set the **integer format** parameter to **Unsigned**, the maximum value is 31. If you set the **integer format** parameter to **Signed**, the maximum value is 32.

**Default: **1

The order in which the binary data stream is packed into integers.

Name | Description |
---|---|

MSB first | Data is packed with the most significant bit (MSB) first. |

LSB first | Data is packed with the least significant bit (LSB) first. |

**Default: ****MSB first**

Input integer format.

Name | Description |
---|---|

Unsigned | The entire number is packed as a positive integer. |

Signed | The most significant bit (MSB) determines the sign of the input integer. |

**Default: ****Unsigned**

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an **error in** input and an **error out** output so that the node can respond to and communicate errors that occur while code is running. The value of **error in** specifies whether an error occurred before the node runs. Most nodes respond to values of **error in** in a standard, predictable way.

**Default: **No error

A Boolean that determines how the node handles buffered data. When the length of the **input bit stream** is not a multiple of the **bits per integer** value, the leftover bits are buffered inside the node. When you set **reset?** to FALSE, these buffered bits are prepended to the **input bit stream** during the next iteration.

**Default: **TRUE

The output integer stream *a* _{ n } *n* = 0…*N*-1, corresponding to the packed bits.

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

**error in** input and an **error out** output so that the node can respond to and communicate errors that occur while code is running. The value of **error in** specifies whether an error occurred before the node runs. Most nodes respond to values of **error in** in a standard, predictable way.

The relationship between the **output integers** array and the **input bit stream** for the unsigned integer format is given by the following equations:

${a}_{n}={\displaystyle \underset{j=0}{\overset{M-1}{\sum}}{b}_{Mn+j}{2}^{(M-1)-j}},\text{\hspace{0.17em}}n=\mathrm{0...}N-1$(**packed bit order** set to MSB First)

${a}_{n}={\displaystyle \underset{j=0}{\overset{M-1}{\sum}}{b}_{Mn+j}{2}^{j}},\text{\hspace{0.17em}}n=\mathrm{0...}N-1$(**packed bit order** set to LSB First)

If you set the **integer format** to **Signed**, then the MSB at the bit position N-1 is used to determine the sign of the output integer. The sign is positive if MSB is 0 and negative if MSB is 1. For example, if you set the **integer format** to **Unsigned** and **bits per integer** as 3, and **packed bit order** as **MSB first**, the bits [1 0 0] are mapped to the integer 4. If **packed bit order** is specified as **LSB first**, the bits are mapped to the integer 1. If the **integer format** is set to **Signed** and **packed bit order** is **MSB first**, the bits [1 0 0 ] are packed to integer -4 because the MSB is 1 in this case. If **packed bit order** is set to **LSB first**, the bits are mapped to integer 1, because MSB is 0 in this case.

This node is continuable, that is, you can call it for multiple iterations inside a loop with **reset?** set to FALSE. In this case, the node buffers the leftover bits whenever the length of the **input bit stream** is not a multiple of the specified **bits per integer**. These leftover bits are prepended to the beginning of the **input bit stream** during the next iteration, provided **reset?** is set to FALSE.

**Where This Node Can Run: **

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application