Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

storing values into array

i would like to store each elapsed time displayed on screen to an array,
This is a 10 seconds elapsed loop, so the array should have 10 elements starting from 1,2,3,4.....9,10 as display by the indicator output on front panel
how do we create the array in this instance
0 Kudos
Message 1 of 2
(2,656 Views)
tpman,

You can easily create an array for each iteration of a loop by using an indexed tunnel. To do this you can wire the Elapsed Time (s) output to the wall of the while loop. This will create an output tunnel. You can then right-click the output tunnel and select "Enable Indexing."

When you perform this action, I think you will be surprised by the resulting array that is generated; you will most likely have thousands of array elements increasing from 0 to 10 by very small increments. This is because the while loop execution will not actually be limited by the Elapsed Time VI. The loop will actually run as fast as your processor will allow.

What I would suggest is to build in some delay into your loop. Essentially if you wait for one second during each iteration of the loop, then the value of the elapsed time indicator should show a one second difference from the previous iteration. This also may not be what you want to see because this will include fractions of a second.

I have attached some example code that shows a few options for you. The option that gives the result that I believe you are going for is to first create an array with a predetermined number of elements. With a one second delay built into your loop, you can then insert the current loop index into that array. I think these options should be clear from the example that I have attached. Please take a look and let me know if you have any further questions. Thanks!

Mike

Message Edited by Duffman Says: on 11-01-2006 02:35 PM

0 Kudos
Message 2 of 2
(2,637 Views)