LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop with local variable control

See attached simplified example for details.

I'm writing a vi which will average an unlimited amount of images. Because of the 16 bit limitations, I'm going to do this in a while loop.

The idea is:
N=images to process
M=maximum nuber of images to fit into 16 bit image.

while N > M
{
N=N-M
process M images
}
process N images

Now this is working, but I want my control to keep displaying the number originally put into it.
So if I put 512 into my control, it should stay a 512 and not change everytime the loop runs.

How do I do this?
Can I make a copy of value in the control and work with that instead of my control?
0 Kudos
Message 1 of 6
(3,125 Views)
To keep the control with the value, you can use a shift register in the while loop. This shift register is initialized to the control value, and on each iteration, the value of this register is updated with the new value, according to programming. The control keeps its value.
I have implemented this solution on your file, hope this helps!!
Message 2 of 6
(3,125 Views)
To keep the control with the value, you can use a shift register in the while loop. This shift register is initialized to the control value, and on each iteration, the value of this register is updated with the new value, according to programming. The control keeps its value.
I have implemented this solution on your file, hope this helps!!
0 Kudos
Message 3 of 6
(3,125 Views)
It seems to me there is a much easier solution for your problem, since all numbers are known at the beginning (see attached example , LabVIEW 7.1):

Your attached code only does your outer loop and my example does the same. Simply calculate the number of averging runs needed and use a FOR loop (For simplicity, I assume the total number of images is an integer power of two and thus divisible by the number of averages without remainder).

These are just some rought ideas, modify as needed. Good luck!
Message 4 of 6
(3,125 Views)
Thanks, I keep forgetting about shift registers.
0 Kudos
Message 5 of 6
(3,125 Views)
Thanks. I have changed it to a for loop, good idea.
0 Kudos
Message 6 of 6
(3,125 Views)