LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Each time I call a VI I get Old data with new data in Array

Solved!
Go to solution
I have selected "clear indicators when called" in my VI properties, execution. Still, each time I call the VI, the array of data grows. My main VI sets up my UUT, and then call's the sub-VI that sets up an instrument to take measurements, then reads the results and passes the data. I then change the UUT to the next state and repeat the same sub-VI task to get the same measurements again. The main VI changes the mode of the UUT three times hence, calls the sub-VI three times. The final call of the sub-VI returns all three sets of data together, which is OK. My problem is, when the main VI finishes and I run another UUT, I get the new set of data along with the complete list of data from the previous run. I found a similar problem answered here on the forum that suggested I should "clear indicators when called", and so I did that. It still did not fix my problem. Any Idea?

 

 

 

 

0 Kudos
Message 1 of 12
(4,249 Views)

Any chance you could post your code?  It would help a lot.  An image would also be useful (.PNG format).

 

Thanks.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 2 of 12
(4,248 Views)

I have attached a .png file to this post.

0 Kudos
Message 3 of 12
(4,245 Views)

Maybe you want to initialize the 2D shift regsiter in the second loop with an empty 2D array? (just right-click...create constant)

 

See if it makes a difference. ;;)

Message 4 of 12
(4,228 Views)

I think you are usng way too much code overall. can you attach the actual VI?

 

For example:

  1. Why is "UUT test freq" in a shift regisiter? an plain non-indexing tunnel would suffice.
  2. What's the purpose of the first loop? What is the size of the "UUT ..." input array?
  3. I think the second loop could be replaced by a plain "reshape array", not sure without seeing actual code.
Message Edited by altenbach on 05-06-2009 01:16 PM
0 Kudos
Message 5 of 12
(4,224 Views)

Hi,

 

there is even more:

Why do you reshape a 1D array to a 1D array using it's size??? That's a LV-NOP Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 12
(4,218 Views)
Initializing the array with 0's cleared everything as needed. Thanks.
0 Kudos
Message 7 of 12
(4,217 Views)

I have attached the  code. If you can't tell, I struggle a little with arrays. The data comming out of the instrument is serial with "n" length. I need to count and then reshape to a 2D array. The UUT test freq is only 1D x 1. the reason I used a shift register is so I get the test frequency appended to the end of each row of data. I like it this way. Are you saying I can achieve the same thing by indexing this data line? I will try. As for the reshape array, I tried many different variants, and finally settled on this. I could not get the display format the way I liked it using any other method. But I have attached the code, so if you could show me an easy way.... Kudo's.

 

Thanks,

T.

0 Kudos
Message 8 of 12
(4,210 Views)
Solution
Accepted by topic author T_Bragg

Try this, for example:

 

Message Edited by altenbach on 05-06-2009 01:50 PM
Download All
Message 9 of 12
(4,184 Views)

nw_4wheeler wrote:

the reason I used a shift register is so I get the test frequency appended to the end of each row of data. I like it this way. Are you saying I can achieve the same thing by indexing this data line?


No, placing an array in a shift register and never modify it inside the loop is equivalent to just using a plain tunnel. (See image). both provide the same data at each iteration.

 

(while the code in general is of course bad, the two loops are equivalent).

 

 

 

Message Edited by altenbach on 05-06-2009 02:02 PM
Message 10 of 12
(4,157 Views)