Check out our General Code Repository Files. Also, before posting here, check to see if your post doesn't fit into another subforum by category.
Tags |
(This content has not been tagged yet)
|
![]() |
Aug 15 2004, 06:49 PM
Post
#1
|
|||
|
I want a LabVIEW icon under my name! Member Posts: 3 Joined: 6-August 04 Member No.: 583 LV:7.0 |
Im trying to send data to a array and want to use 'i' from the while loop as the index for the array.
Ive wired it up the only way i can think of but the array is still empty after running the VI Any idea what im doing wrong?? See picture (looking at 'average weight array')
|
||
|
|
|||
| Ad |
Aug 15 2004, 06:49 PM
Post
#
|
||
|
|
|
||
|
|
|||
Aug 15 2004, 06:51 PM
Post
#2
|
|||
|
I want a LabVIEW icon under my name! Member Posts: 3 Joined: 6-August 04 Member No.: 583 LV:7.0 |
|
||
|
|
|||
Aug 16 2004, 12:32 PM
Post
#3
|
|||
![]() More Active Member Posts: 48 Joined: 20-April 04 From: Ontario, Canada Member No.: 365 LV:7.1
|
It looks like you want to build an array in the loop and use the data logged in previous iterations. For persistent local storage, use a shift register. In the attached vi there are four arrays that are populated from a while loop that terminates after a set number of iterations.
The first array is trivial - it is populated and autoindexed from the while loop. The second array is populated manually using a shift register and the "Insert into array" function. The third array again uses a shift register, but only populates the itself if 'i' is an even number. The final array uses two shift registers - one, is for local storage of the array (just like the above two arrays), but the second shift register stores previous values of 'i'. By right clicking on the shift register, you can add historical elements. So, the first shift register thingme on the right side of the loop is the last element stored, the next is the second last element, etc. As a result, you can keep track of variables from previous iterations. This last array only populates if the current value of 'i' is equal to the sum of the last two values (e.g. 1+2=3 - so 3 is a valid number). When the loop starts, it initializes all values. However, this is not necessary - you could make the vi reentrant and keep the value persistent for each call the this vi. Hope this helps. Cheers, James
Attached File(s)
|
||
|
|
|||
![]() ![]() |
| Time is now: 22nd November 2008 - 02:10 AM |