07-26-2016 07:35 AM
Hello all,
Does anyone know any method of including a progress indicator for a loop iteration? The motivation is that I use a wait function to hold the VI while a spectrum is acquired from an oscilloscope, and I was trying to use the count from the wait function linked to a slide bar in a sub while loop but this doesn't seem to work at all.
Maybe someone already has a solution?
Thanks!
07-26-2016 07:38 AM - edited 07-26-2016 07:38 AM
Plenty of solutions available one such: https://decibel.ni.com/content/docs/DOC-2061
and this http://www.ni.com/example/26232/en/
07-26-2016 07:48 AM
quantisedpenguin wrote: I was trying to use the count from the wait function linked to a slide bar in a sub while loop but this doesn't seem to work at all.
Try using the iteration terminal of the loop. If you know how long you are waiting, use a FOR loop to run 100 times (as an example). So if you need to wait 1 second, you set your wait inside of the loop to 10ms. Each iteration of the loop will increment the slider for you.
07-26-2016 08:31 AM
Hi, thanks for the reply!
The decibel one I also found, this is where I got the inspiration for my first attempt. I'll have a look at the second one you posted and see if that works.
Thanks again
07-26-2016 08:34 AM
I think there is some slight confussion, I don't need the progress of the whole loop, I need the progress of an induvidual interation of the loop!
07-26-2016 08:51 AM
Do you want your indication to be something that progresses from 0 to 100%? Or something that tells how long the loop has been running?
You can't know if you are at 100% unless you know how long the single loop iteration takes. What you can do is set up a separate loop whose sole job is to update your time indicator, or your progress bar. Have the loop send a notification when it starts to the other while loop to start the timer. Have it send another to stop the timer.
07-26-2016 10:46 AM
@quantisedpenguin wrote:I think there is some slight confussion, I don't need the progress of the whole loop, I need the progress of an induvidual interation of the loop!
The progress indicator only gets update once per loop iteration, so of you need finer control, you need to create something that updates more often. What is the time limiting process inside the loop? If it is another loop, you could use that, place the indicator in the innermost loop, and use a combination of the inner and outer iteration terminal to compute the fractional progress.
Also note that if you use parallelized FOR loop, the value from the iteration terminal may not be sequential but will jump all over the pace. (There is a progress bar solution for that scenario too, but it is slightly more complicated.).