LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a value from an array in a nested loop

Hi

I have an array inside a four loop. The for loop (it is supposed to run 4 times) is further inside a while loop. The array consists of four elements and the values each of these elements are fed before running the program. To receive the values of each of these elements one by one outside the for loop, I am using the function index array. To receive all the values one by one, I created a shift register and wired the output of the index arrray to it. The problem is that instead of receiving all the values one by one, I am receiving only the value in the fourth
element of the array...Can someone please help me..
0 Kudos
Message 1 of 3
(2,905 Views)
The attached file is my program.
0 Kudos
Message 2 of 3
(2,902 Views)
The output of a shift register will always show the very last value written to it. The for loop executes 4 times, the last value is then passed to the indicator. Your local doesn't work because it's outside the for loop and the value is only refreshed once the for loop finishes. Again, it will only show the last value in the iteration. You can create a local of your indicator called "method 2", put that inside the for loop, wire it to the shift regist and the "method 2" indicator will update as the for loop runs.
Message 3 of 3
(2,897 Views)