LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: How to provide values to an array inside a for loop?

Hi

The attached file contains my vi.

I want to know how can I store values inside an array. Suppose that I am continoulsy receiving values from an instrumen and each of the values that I am receiving corresponds to the value of a particular variable. Now I want to store these values inside an array and an index in the array has been assinged to each of the variable. This is to distinguish the values stored inside the array.

To create such a hypothetical situation, I have used 2 for loops inside a while loop. The first for loop consists of a control array which contains 4 values. Each of these values is passed one by one outside the for loop and are shown on the indicator "Method 2 of getting the value". Then, I am using this indicator to store the values (from control array) in the indicator array. However I am not able to do so..

For the indicator array, the output should be as follows:
Index Value
0 1
1 2
2 3
3 4
But the problem is that it always keeps changing
0 Kudos
Message 1 of 3
(2,569 Views)
Hi Gagan,
You can use a Queue instead of the "Mehtod 2 of getting the value" variable. Enqueue data in the first for loop, Dequeue data in the second loop. You can find queue operations in /Functions Palette/All Functions/Advanced/Sychronization/.
Hope helps,
Xu
0 Kudos
Message 2 of 3
(2,560 Views)
I had answered this question in one of your previous posts, but now that you've made it more clear of what you are trying to do, here is an example that works better.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 3
(2,544 Views)