Another more efficient way of doing this, when the loop is not in a sub-vi,
is to write the data into a queue inside the for/while loop and then somewhere
else in your vi read data from the queue. In this way data can be passed
in and out of loops with out the drawbacks of using global/local variables.
If in a subvi: Create an indicator in your main vi, pass a control reference
of that indicator into the subvi and alter the value of the indicator using
a property node. Anytime you can avoid using globals or locals, you should
as this can slow your program and introduce race conditions.
"G Caesar" wrote:
>Mr Graham is correct, the first thing you should try is to simply place
the>indicator inside the WHILE or FOR loop. However, in some cases this
is not>practical - perhaps the most common being when your loop is in a sub-vi.
In>this case you could write to a global variable inside the loop. In your>main
VI, you can then have a 2nd loop, parallel to the first, reading from>the
global and updating an indicator on your front panel.>>There are several
global variables examples that ship with LabVIEW - take a>look at them and
see if they are helpful. If not, I have a sample program>that does the above
on my machine at work. Just let me know if you are>interested and I can
send it tomorrow if needed.>>Regards,>Greg>>Craig Graham
wrote in message>news:3a826d9a@newsgroups.ni.com...>> Can't make out exactly
what you're on about but there shouldn't be a>> difference between the FOR
loop and the WHILE loop approach. In both cases>> to get an indicator to
update as the loop iterates you simply put the>> terminal of that indicator
inside the loop.>>>> The only difference I'm aware of between the way data
comes out of the two>> loops is that wires coming out of a FOR loop default
to auto-indexing, and>> wires coming out of a WHILE don't. Do when a wire
comes out of the for>loop>> it becomes an array, whilst the wire coming out
of the while loop remains>as>> the last data value the wire held. If this
is your problem, just pop up>with>> the right mouse button over the "blob"
where the wire leaves the loop and>> you'll see the "Enable auto-indexing"
option.>>>> Will wrote in message>> news:3a81cce4@newsgroups.ni.com...>>
>>> > I apologize... the subject should say from while loops. On a sidenote>to>>
> this. I have managed to do this with for loops. However, I cannot>abort>>
> my operation with for loops, and this is an option I do need. Darn for>>
loops!!>> > Thanks again. Will>>>>>>>>Craig Graham
wrote in message>news:3a826d9a@newsgroups.ni.com...>> Can't make out exactly
what you're on about but there shouldn't be a>> difference between the FOR
loop and the WHILE loop approach. In both cases>> to get an indicator to
update as the loop iterates you simply put the>> terminal of that indicator
inside the loop.>>>> The only difference I'm aware of between the way data
comes out of the two>> loops is that wires coming out of a FOR loop default
to auto-indexing, and>> wires coming out of a WHILE don't. Do when a wire
comes out of the for>loop>> it becomes an array, whilst the wire coming out
of the while loop remains>as>> the last data value the wire held. If this
is your problem, just pop up>with>> the right mouse button over the "blob"
where the wire leaves the loop and>> you'll see the "Enable auto-indexing"
option.>>>> Will wrote in message>> news:3a81cce4@newsgroups.ni.com...>>
>>> > I apologize... the subject should say from while loops. On a sidenote>to>>
> this. I have managed to do this with for loops. However, I cannot>abort>>
> my operation with for loops, and this is an option I do need. Darn for>>
loops!!>> > Thanks again. Will>>>>>>>>