ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop structures

Hi

I was wondering, if there exists a while-loop in LV. Now don't think "what kind of problem has this guy - there is a while-loop" - I know there is, but compared to a textual language it's a do-while-loop (footer controled).

I want to know if a header-controled loop exists or if it may come with a future release of LV.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 1 of 16
(7,525 Views)
Hi becktho,

I don't know if there's anything in the pipeline, but until then you could try a conjunction of while/case structures.

See attached VI.

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 2 of 16
(7,515 Views)
Hi Charlie

I know what you mean and use it like this (still your attempt shall be honoured ;)), but I'd like to get rid of this way.

And the best thing for that was a header-controled while-loop.


Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 3 of 16
(7,512 Views)
Hi becktho,

I have raised this topic when I've been at NI (Newbury) before. They are at least aware of the problem, but I don't know if we'll see anything soon 🙂

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 4 of 16
(7,506 Views)
Hi Thomas,

Please make yourself heard the best way by submitting a Product Suggestion through the "feedback" link on www.ni.com/contact. That way, your suggestion will get directed to the appropriate LabVIEW developer.

Have fun!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
Message 5 of 16
(7,478 Views)
If you just want a while loop where the termination condition is checked before each code iteration, use something like in the attached image. I don't think we need an entirely new loop species. 🙂

Message Edited by altenbach on 05-19-2005 07:54 AM

0 Kudos
Message 6 of 16
(7,471 Views)
Thanks for the peanut! 🙂

Strong opinions either way should probably be spelled out in a reply so we can all learn and improve our thinking. 😉
0 Kudos
Message 7 of 16
(7,459 Views)
Hi great wizard

Yes your right - your example works. But I think it was easier if I don't have to draw the case-structure all the time. And also to have your loop available in the palette is not the right way, I think.
In addition - if you have several criteria to stop the loop, maybe it must be enlarged too much (I don't like hiding code).

Just for comparison in a textual language you don't write

do{
if(i < 5){
...
}
}while(i < 5)

Thomas

BTW - gave you a five-star rating. But as you see, the average is just 3 :(.

Message Edited by becktho on 05-19-2005 05:29 PM

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 16
(7,453 Views)
Thanks. My main concern was that I could not come up with a simple graphical programming element design that would do what you want directly. I need to ponder a bit more....

Do you have any ideas how it could look like? How should the outputs be handled if it does not execute al all?
(e.g. similar to a FOR loop with zero iterations, which is allowed and defined).

(If the need really exists, I am sure that the wizards at NI will come up with a stunningly beautiful and intuitive new loop structure that does exactly what you want. :))
0 Kudos
Message 9 of 16
(7,443 Views)
If, in a textual language, a standard while loop was *not* available (only a do-while) then how would it be written?
I would think it would turn out something like this:

if( condition ) {
do {
} while(condition)
}

IE, I guess I agree with the first posters in the group on this one 😃

Message Edited by Chaos on 05-19-2005 11:01 AM

0 Kudos
Message 10 of 16
(7,269 Views)