LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call to VI slower on second and third iteration

Solved!
Go to solution

Hello all,

 

Simply put, I am building a program that takes 1D arrays and concatenates them into a 2D array from which I take the mean/mode/etc of each column and represent the result as a single 1D array.  I have placed this part of the code in a different VI made a connector terminal and so on.  I placed this VI in a state machine and I call it everytime that "state" is activated, when I call the VI for the first time it is quick and responsive (approximately 10 seconds to produce the data), once this is finished the state machine continues in another state and once I call that state again the VI will take 20-30 seconds, if I do this a third time it can take up to 5 minutes to produce the data.  Everytime I call the VI i give it identical length arrays and the computations should be very very similar, is it possible that the VI is "holding" the data in its arrays and they're building to be longer and longer every time I call it?  If so is there any way to clear all variables and make it start all the arrays from the begining again?

 

I guess I'm new to data manipulation (most of my work is in hardware configuration), but please if anyone has any advice that's be great!

 

I can post a demo program if people would like,

 

Thanks.

0 Kudos
Message 1 of 9
(2,613 Views)

My guess is you have an uninitialized shift register. Posting an example would definitely help.

Message 2 of 9
(2,612 Views)
Solution
Accepted by topic author ngio

My main thought is that you are building your array and concatinating onto your previous array.  As already stated, it is likely an uninitialized shift register or something of the like.  Posting the VI will allow us to debug easier.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 9
(2,600 Views)

Phenomenal, thats exactly the issue!!   I have wired an "Initialize array" to the shift registers (I had many) and the program runs at its proper speed everytime I execute it.

 

Thanks both of you very much for your assistance.

 

 

 

 

 

0 Kudos
Message 4 of 9
(2,572 Views)

What is an "initialize array"? Typically you would simply wire an empty array diagram constant. ;).

0 Kudos
Message 5 of 9
(2,558 Views)

@altenbach wrote:

What is an "initialize array"? Typically you would simply wire an empty array diagram constant. ;).


I think it's safe to assume the poster meant exactly what they wrote, and connected the "initialize array" function to the shift register.  With a 0 length, one hopes.

0 Kudos
Message 6 of 9
(2,555 Views)

Regardless, it resets the array size each time, even if it were to a new 1000 post array. 🙂

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 9
(2,546 Views)

This is correct, I attached an "initialize array" vi with a size of 0 to the shift register of the loop.  As Yamaeda pointed out, it resets the array for me.  I do suppose however, what altenbach is saying would work as well, and likely his solution is more direct and therefore possibly more computationally efficient?  just a guess, I haven't checked.

 

 

0 Kudos
Message 8 of 9
(2,501 Views)

@ngio wrote:

This is correct, I attached an "initialize array" vi with a size of 0 to the shift register of the loop.  As Yamaeda pointed out, it resets the array for me.  I do suppose however, what altenbach is saying would work as well, and likely his solution is more direct and therefore possibly more computationally efficient?  just a guess, I haven't checked.


While I'm not completely certain of this, I expect that an empty array constant is equivalent to Initialize Array with a 0 length input, since the initialize array should get folded into a constant during compilation.

0 Kudos
Message 9 of 9
(2,490 Views)