LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a For Loop

How do I stop a for loop with a stop button? I have 2 case structures and 2 while loops inside my for loop.

 

 

0 Kudos
Message 1 of 11
(3,448 Views)

@Mike227 wrote:

How do I stop a for loop with a stop button? I have 2 case structures and 2 while loops inside my for loop.

 

 



Change the FOR loop to a WHILE loop.

 

 

0 Kudos
Message 2 of 11
(3,443 Views)

select and right click on the for loop, and check conditional terminal.



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 3 of 11
(3,440 Views)

Attached is my VI.

 

I think I need the FOR loop because I use an iteration control. (control off of the N symbol) And I have an auto indexing array feeding in.

0 Kudos
Message 4 of 11
(3,431 Views)

@Mike227 wrote:

Attached is my VI.

 

I think I need the FOR loop because I use an iteration control. (control off of the N symbol) And I have an auto indexing array feeding in.



If you stop the FOR loop, then not all the elements array are going to be processed. If that is fine with you, then do it.

 

 

0 Kudos
Message 5 of 11
(3,427 Views)

yea, but how would I do that? Ive tried the conditional terminal for the FOR loop, and it then won't write my text to the file.

0 Kudos
Message 6 of 11
(3,422 Views)

Is there an error being generated?  An error should be the only thing keeping the file from writing.


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
0 Kudos
Message 7 of 11
(3,418 Views)

There are no errors that I can find. Is there a way to manually find an error?

0 Kudos
Message 8 of 11
(3,415 Views)

Mike227 wrote:

I think I need the FOR loop because I use an iteration control. (control off of the N symbol) And I have an auto indexing array feeding in.


Your array is empty, thus the for loop will iterate zero times, no matter how big the number wired to N is.

I would recommmend to exclusively stick to "build path", "strip path" primitives. Dont manipulate entire paths as strings.

Should "test programs" be a folder or part of the filename? Does the folder exist?

If you want to stop at any time, the stop button belongs into the innermost loop.

0 Kudos
Message 9 of 11
(3,408 Views)

Also note that you use an obsolete file open function. But since you wired the start path, it seems that "test programs" is actually a folder name and not part of the desired file name.

 

Anyway, your upper left code could look as follows.

 

 

 

Also note that making a string diagram constant bold will not make the text in the resulting file bold. 😄

 

0 Kudos
Message 10 of 11
(3,395 Views)