LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

resetting "for loop" within "subvi"

Solved!
Go to solution

Hi guys, 

 

Quick but perhaps extreme stupid question. I've got a rather large VI with several subVI's. Inside those subVI's there are some for-loops which do not seem to reset whenever the subVI is called upon. Whilst doing the data analysis it basically accumulates the data from the previous file as well. For example:

 

file A gives 4 variable outcomes out of the subVI's for-loop

file B gives 5 variable outcomes out of the subVI's for-loop

 

Not this will show up in the final array as having 9-outcomes, and not 5 which I would expect. 

 

I have been playing around with deleting the points of interest, but I was wondering if there was an easier option?

 

ta

 

Patrick

0 Kudos
Message 1 of 6
(2,549 Views)

Without seeing any of your sub vi, I can only guess that you're building an array in a loop with an uninitialized shift register.

 

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 6
(2,540 Views)

Instead I've been setting it up along these lines:

 

 

And for some unexplained reason this does not reset the initial empty array to which the new values (obviously in the above case without analysis) are being added to the output array... I just don't get what I'm doing wrong?

0 Kudos
Message 3 of 6
(2,538 Views)
Solution
Accepted by topic author Paddy1985

The loopback node's initialize works like a First call, and since it's still in memory it's only reset once.

(correct me if i'm wrong)

 

/Y 

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

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 6
(2,529 Views)

@Yamaeda wrote:

The loopback node's initialize works like a First call, and since it's still in memory it's only reset once.

(correct me if i'm wrong)

 

/Y 


You're correct (and so was I).

 

sub_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 5 of 6
(2,519 Views)

Thanks Guys, I'll give it a make-over!

0 Kudos
Message 6 of 6
(2,515 Views)