LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute a For Loop in a While Loop Only Once


@altenbach wrote:

@adamdempsey wrote:

What I am confused about is that when the for loop is finished, I want the entire VI to stop.  I am struggling how to have a signal that tells me the for loop is done. 


You would just wire a true to the stop condition from within the event that processes the files in a FOR loop. It is all in the dataflow! The event case cannot complete until everything is it has completed.  (NOT recommended!, see below)

 

This is not proper architecture! A program is ended by the user, not by itself. (MS word does not "stop" when you are done writing that resume, e.g. when you press "save", it would save the document and then kill itself!). A proper state machine is set to run when opened, and waits in an idle state for user input. It will wait for the command and then start processing the tdms files, giving you progress updates and even a chance to interrupt or start over with different settings if you notice that it does not do what you meant. At the end, it will tell you that all files have been processed and how long it took, giving you the option to close the program or process another set.

 

 


We need to slow down here...

We do not know what the OP's requirements are. Perhaps this is a tool they build for personal use. I have created many "single run" vi... that usually turn into sub-vis.

My first guess is that the while loop is not required.... along with the single run for-loop.

 

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 21 of 23
(440 Views)

@Frozen wrote:
We need to slow down here...

We do not know what the OP's requirements are. Perhaps this is a tool they build for personal use. I have created many "single run" vi... that usually turn into sub-vis.

My first guess is that the while loop is not required.... along with the single run for-loop.

 


 

Exactly. If it is just a one-shot downhill run, there should not even be a while loop.

 

(... but then we have the new users that presses the "continuous run" button and we are back to square one 😄 )

 

(If we really want the full UI experience, it would give an interactive preview of the files to be processed based on path and booleans, etc. so we can verify that it will really do what we want before giving the go. Here we need the while loop.)

0 Kudos
Message 22 of 23
(420 Views)

@altenbach wrote:

.. but then we have the new users that presses the "continuous run" button and we are back to square one 😄


Some times you just can't win 😁

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 23 of 23
(391 Views)