LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute a For Loop in a While Loop Only Once

I have a for loop inside a while loop in a VI.  The while loop is there so the user can select some Boolean options on the front panel and navigate to some file directories.  Then once everything is setup, the user hits a button, which executes a for loop and "post processes" the tdms files in the directory the user selected.  My problem is, once the for loop is finished, it just starts over again and starts processing the files over again. 

 

I want the the entire while and VI to stop, once the for loop is finished. How do I do that?

 

Thanks!

Adam

0 Kudos
Message 1 of 23
(3,314 Views)

Add an OR node before the conditional terminal to capture the Boolean value from the Stop button and a True value from the For Loop.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 2 of 23
(3,292 Views)

Move the for loop out of the while loop so that when "the user hits a button" the while loop stops, and you move on to running whatever is in the for loop (may not even need the for loop if it's only executing once), once that stuff executes the VI is complete. 

0 Kudos
Message 3 of 23
(3,250 Views)

Another (better?) option is to create a simple state machine.

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 4 of 23
(3,237 Views)

Can you elaborate on how to create a simple state machine?

0 Kudos
Message 5 of 23
(3,231 Views)

WolfmansBrother - thanks for uploading an example VI.  I only have LabView 2019, so can you upload a 2019 version for me?

 

Thanks!

0 Kudos
Message 6 of 23
(3,224 Views)

let me google that for you...

 

https://labviewwiki.org/wiki/State_Machine

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 7 of 23
(3,217 Views)

Resources to look at would be

 

- NI Simple State Machine Template

 

or google "labview state machine"

 

CLA, CTA
0 Kudos
Message 8 of 23
(3,213 Views)
0 Kudos
Message 9 of 23
(3,211 Views)

Yep, I guess I could have googled that.  🙂

0 Kudos
Message 10 of 23
(3,190 Views)