Riho,
Hello again. First, when you put the array indicator outside the second loop and use the edge of the loop to gather the data into an array (using the loop autoindex) you will not see the data in the array until you stop the while loop. What is happening is : you press the boolean button to allow the local variable to output its value to the loop edge. This continues to happen for each iteratio of the loop while the button is pressed. As this is happening though, you do not see the info in the array. Why? Because the array is outside the loop. The data is collected at the edge of the loop and automatically stored in an array (the autoindex array of the loop) but nothing gets passed out of the loop until the loop stops. When the loop stops all the acquired data gets passed out to the array. The problem with this method is you press the button, data is acquired, but you dont know what data is acquired because you cant see it until the loop is stopped. Once the loop is stopped, it cannot start again until you stop and re-start the whole program. you need to have the array inside the loop so you can see what you are acquiring.
Second, now that you have the array inside the loop so that you can see what is being acquired, you have a new problem. Your data source is a single element and your display is an array. The two cannot be wired directly together. You need a 'build array' or 'replace array element' sub-vi in between your single element and your array. For now, to keep it simple, we will use the 'build array' function. it is wasteful in its memory allocation practices but i don't think right now you know the max size of your array and initializing and resizing arrays is another discussion. Lets first get through this problem.
Ok, i've attached a new sub-vi. This is how it works. One while loop, not two, but you could use the local variable method if you feel you need to seperate the two procedures again. The data source outputs to the chart and is branched off to a case structure. The case is controlled by a boolean switch to start data gathering into the array. The true case holds a build array function using the single element from the data source and an array. the output (of both cases) goes to the array indicator and a shift register on the edge of the while loop. Not familiar with shift registers? You should look into them, they are very helpful inside loops. The reason for the shift register is that earlier in this paragraph i stated the build array function had two inputs, one of them being an array. This is the array you are viewing and appending each new value onto. When you append a value and display it in one iteration of the loop, you need to pass this array into the next iteration so you can append a new value onto it. This is what the shift register does. In the false case, the array from the shift register is just passed through to the display without appending anything.
Hope this helps,
Jared
Posted and emailed