07-05-2005 11:14 PM
07-06-2005 02:14 AM
You can't.
You can either use the Abort VI (from the Application Control palette) which will stop the entire VI, and is bad practice anyway, or you can replace your for loop with a while loop and add your condition to the stop condition using an Or node.
07-06-2005 07:21 AM
One other possibility, depending on how many times the loop is set to execute, is to put a case statement around the code you wish to no longer execute. You should have some "wait" function in your loop to keep it from taking all of the CPU when looping, just make the one in the "non-execute" case very short (i.e. 1mS). Of course if the loop is expected to execute 1000's of times in the normal case you will get the obvious delay from whatever iteration it is on until it completes. The best answer, as stated before, is to restructure the code to allow a while loop. It can be made to essentially perform like a For Loop, with a count value comparison to the interation value, but it has the additional advantage of being able to terminate at any time. If there are instances where you don't want the internal code to execute even once you will still need to put it into a case statement as the while loop will execute at least once, even if the "stop loop" is set to terminate.
P.M.

07-06-2005 08:00 AM