Home > Support > NI Product Manuals > LabVIEW Communications System Design Suite 1.0 Manual

Accessing Data from Multiple Past Loop Iterations

A shift register passes values from one loop iteration to the next, but sometimes you need to access values from more than just the previous iteration. You can use stacked shift registers to store values from multiple previous iterations and pass those values to the current iteration.

What to Use

What to Do

Create the following diagram to pass data from the two most recent loop iterations to the current iteration.

Customize the gray sections for your unique programming goals.

A right shift register always passes data to the next loop iteration, regardless of whether you want to share data among one or multiple loop iterations.

To create a pair of shift registers, right-click the loop border and select Create Shift Register.

After each iteration, the first left shift register contains the data passed from the right shift register.

Access this data by wiring the output of the first left shift register to the code inside the loop.

The second left shift register contains the data from the second most recent iteration. After receiving a new value, stacked shift registers pass the value they previously contained down the stack to the next shift register.

To create stacked shift registers, right-click the left shift register and select Add Element. Repeat for each shift register you want to stack.

Just like for single shift registers, specify an initial value for each stacked shift register to ensure that each one has a predictable value for the first loop iteration. Each left shift register that lacks an initial value uses the most recent value it contained, even if that value is from a previous loop execution.

After the loop executes, access the data from the last iteration by wiring the output of the right shift register to the rest of the program.

Only values from the last iteration exit the loop through the output of the right shift register.


In the previous example, the value contained in each shift register changed after each loop iteration. The following table records the data each shift register contains after each loop iteration, assuming the following conditions:

  • The loop count is 3.
  • The initial value wired to the first left shift register is 5.
  • The initial value 2 wired to the second left shift register is 2.
Shift Register Note First Iteration Value Second Iteration Value Third Iteration Value
First left shift register

The first left shift register receives new values from the right shift register.

5 7 12
Second left shift register

The second left shift register receives new values from first left shift register.

2 5 7
Right shift register

The right shift register receives values from the subdiagram of the loop.

7 12 19