LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to sum in a loop?

I use a "while" loop in which I calculate a value of variable (the value is different in each iterration).
I need to calculate the sum of all calculated values in the loop.
It can be written like this:
Sum:=Sum+h

where h - is a calculated variable.
How to implement it in LabView? I use ver 6.1
0 Kudos
Message 1 of 4
(16,782 Views)
You need to use a shift register--see attached image. To create the shift register at the boundary of your loop, right-click on the loop wall and select "Add Shift Register."

For more details about when and how to use shift registers, refer to your LabVIEW User Manual.

Regards,
John
Message 2 of 4
(16,774 Views)
If I understand your question correctly you can accomplish this using a shift register in the while loop. Pass the sum into every iteration of the loop and then add "h" to the sum

See the attached photo.

Nick
Nick Argyros
Interconnect Devices Inc.
Electrical Test Engeiner
nicka@idinet.com
Message 3 of 4
(16,773 Views)
Thanx
0 Kudos
Message 4 of 4
(16,757 Views)