LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array elements keep returning to their initial value after being replaced

Hello,

This is my first post here, but this looks like a great place to discuss labview.

I have a strange problem that probably has a simple answer.

Basically, I have initialized an array outside of a "for loop" that contains a "flat sequence structure."  I use the array inside the flat seq structure, replacing elements within the array, incrementaly by 1 starting with index 0, so i have run a wire through the "for loop" barrier and then through the "flat seq structure box".

However when I step through my VI what happens is this.

On the first run through, it succesfully changes the element at index 0.  On the next iteration it succesfully replaces the element at index 1, however, now index 0 has returned to its initial value! Smiley Mad  .... This continues.... say im up to my 100th iteration, all the previous indexes have all returned to their initialized value but index 99 (its the 100th iteration) now has the value it should...however on the next iteration, index 99 will return to its initialized value.... its a vicious cycle..Smiley Wink

Can anybody tell me what I've screwed up?

Thanks a Million,
Nick
0 Kudos
Message 1 of 3
(2,850 Views)

hi falgandha here

 

Please send me your vi or its snapshots and what do you exactly want to do so ican help you

0 Kudos
Message 2 of 3
(2,837 Views)
Are you using a shift register on your loop or a tunnel?  If you are using a tunnel, then the orginal value is always passed into the loop.  If you use a shift register, then each iteration of the loop has the value passed in the last iteration of the loop.  I'm not at work, so can't setup a perfect example, but this is from an example I showed someone else.  The first two examples I show here are using shift registers and a 2-D array.  The second example uses an element only available in later versions of LV, but is supposed to be more efficient memory wise.


0 Kudos
Message 3 of 3
(2,835 Views)