LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stoping For loop before it's finished.

It's possible to stop for loop in the middle of an operation.

T.U.
0 Kudos
Message 1 of 5
(3,193 Views)
No, you should use a while loop.
Gorka Larrea
glarrea_1@hotmail.com


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
0 Kudos
Message 2 of 5
(3,193 Views)
Shaoul Dotan wrote:

> It's possible to stop for loop in the middle of an operation.
>
> T.U.

As a follow in it IS NOT possible to stop a for loop EXCEPT
to HALT the VI or EXIT LabVIEW altoghter.
Kevin
0 Kudos
Message 3 of 5
(3,193 Views)
"Shaoul Dotan" writes:

> It's possible to stop for loop in the middle of an operation.
>
> T.U.

Shaoul,

as others explained why it's a bad thing, here is a very ugly trick to
acomplish something of it. It's so ugly I won't use it in my programs.

I'll assume you do something with an array in your for loop. To "stop"
the loop you can use a case structure with 2 cases: one empty and the
other with a huge delay (e. g. 40 days). To get the data out of the
for loop you have to use a local variable for the whole array so you
need to work with shift registers and "append to array".

The way to reintroduce data dependency outside the for loop is by
polling the array size of the local variable. If it didn't grow for
e. g. 100 ms the for loop is "
finished" and in the delay state.

The downside of this trick is that the vi doesn't finish and you have
to abort it.


Does someone in this group know about the obfuscated C contest, where
you try to write C code that noone can understand? What about doing
something like that in G? We have some guidelines how to wire; the
contest could reveal ways how _not_ to it.

Johannes Niess
0 Kudos
Message 4 of 5
(3,193 Views)
Johannes Niess wrote:

>
> Does someone in this group know about the obfuscated C contest, where
> you try to write C code that noone can understand? What about doing
> something like that in G? We have some guidelines how to wire; the
> contest could reveal ways how _not_ to it.
>
> Johannes Niess

I have heard of the Obfuscated C contest before, I have never seen
one for G, though some of the code I have reviewed could probably WIN !!!.

Of course I think one of the rules is that the code must actually work
(ie do something wheter it is useful or not does not matter).

So lets put one one and see the "Best of the Worst" !!

Kevin Kent
0 Kudos
Message 5 of 5
(3,193 Views)