|
|||||||||||||
06-12-2006 01:14 PM
Just give me a for loop with a start, stop, and break and all will be well.
08-15-2006 11:56 AM
Hello all,
Thanks again to everyone who has contributed to this topic. Now that 8.20 is out the door, I had a brainstorming meeting with other developers on this topic. As much as I liked the idea of a Flex Loop for how easy it made a lot of very common operations--things that are easy enough to code with LabVIEW functions, but clutter up the diagram and make it harder to read--there was a lot of resistance to adding yet another structure to the Structures palette, and to the LabVIEW language in general. For new users, this makes LabVIEW more complicated and difficult to learn. For experienced users, it's noise...either they like the Flex Loop and use it exclusively (in which case, the For and While loops are noise), or they never want to use it and it becomes noise itself.
That doesn't mean, however, that we can't help make some of the common operations you have mentioned so far easier. Perhaps we can add functionality to the existing For and While loops to allow for some of the things mentioned, like custom shifting/scaling of the iterator terminal and allowing more configurability to the auto-index terminals. But at this time, we're not convinced that the use cases are common enough to make these changes worthwhile.
So, what I would like from you all is examples (preferably VIs) of when these features would be useful and would have simplified your diagram. This way, we can discuss a solution to as general a problem as possible, hopefully making LabVIEW a more productive tool for everyone.
Thanks in advance,
Robbie
08-16-2006 08:01 AM
crelf wrote:
One feature I've been asking for for years: a native wait in every loop:
If unwired it would default to 0, and at least let thread switching occur. You could maybe right click on the loop and remove the wait node to make it run as fast as possible (like it is now), but it should be there by default... (PS: I know that you can do this using timed loops, but I'd like to see it in all of them - I've seen too many "programmers" complain that their CPU is at 100% because their loops are going nuts).

08-16-2006 08:25 AM
08-29-2006 07:32 PM
Here's the (simple) benefit as I see it.
Rather than having to do something like this:

We can do this:

I think that just being able to do this would cover most of the times I would find this feature helpful. All the other suggestions about start/stop/iteration/waits etc. are helpful, and I would find them useful, but in my mind they're all gravy. Can we agree that at a minimum this is what everyone wants? (probably not, but I can dream ...)![]()
My vote would be to add something like "Early Break Node" to the "Visible Items" context menu for a For Loop, and have it hidden by default when a For Loop is dropped.
Jaegen
08-30-2006 02:37 AM
08-30-2006 09:13 AM
08-31-2006 03:25 AM
08-31-2006 10:15 AM
I like it, but is there any way you can come up with to make this a decent pre-test loop instead of a post-test loop? The For Loop tests its loop condition (i < N?) at the start of the loop, and it would be nice to have a way to encode (i<N and MY_TEST) into the pre-test portion...Putting the stop terminal inside the loop doesn't help any of that. So I'm sort of a reluctant supporter of the For loop's stop terminal. It helps, but because of its location it misses uses cases, so I wonder if there might be a better idea from anyone?
An ugly thought for early Break: have a right-click option on the stop terminal to designate whether or not outputs should be updated on the iteration where an early Break occurs. The default behavior would be a post-loop test (like today's While loop that also uses the Stop terminal), but the equivalent of a pre-loop test can be selected. Some visual clue would need to indicate the mode -- perhaps the Loop boundary since the mode affects ALL outputs.
As to the iterator options, I would suggest a right-click option on the Loop boundary for "show iterator terminals". The terminals would be i_init and i_inc, both represented as i32 values. If unshown or unwired, the defaults would be i_init = 0 and i_inc = +1.
I would purposely NOT include an i_final terminal. Having one can lead to conflicts with auto-indexing or a wired "N", which would require precedence rules. It would also lead to confusion for cases where someone has i_init=0, i_inc=5, and i_final = 12. Should it terminate at i=10 or at i=15? I believe that any desire to use an i_final termination condition can be readily accomodated by wiring through and using the "Break" terminal with the mode option described earlier. This is also likely to make the termination logic more explicit.
-Kevin P.
08-31-2006 10:24 AM - edited 08-31-2006 10:24 AM
Jaegen wrote:
Rather than having to do something like this:
![]()
Jaegen,
Maybe I don't quite understand your code, but I think you're a bit unfair here, because your code is more complicated than needed. From what I can see, the entire case structure can be omitted without any change in outcome. Why would you need to replace an element with itself in the array if it is > 10??? That's equal to a NOOP.
Jaegen wrote:
We can do this:
![]()
We can already do this. Just use a while loop!
(See image top)
One alternative, way to code the problem with the current tools is shown below. "Look ma, no loops!"

Message Edited by altenbach on 08-31-2006 08:25 AM
My Profile | Privacy |
Legal |
Contact NI
© 2011 National Instruments Corporation. All rights reserved. | E-Mail this Page
|
||

E-Mail this Page