LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to post threads

I am new to labview and I am trying to sum results that are output from a certain math function. This is what I am trying to do in detail:
 
I have a while loop that divides a number by two, then checks the remainder to see if it zero. If it is not, it will continue to divide the remainder resutling from the first, second...division by two until the a zero is detected. If a zero is detected, the loop will be stopped. During this whole process The quotient resulting from each division is multiplied by 2^(i), where (i) is each loop iteration. Here is where I am confused- the result of the multiplication is then fed into a build array and the array is added by the add array element function. However, this doesn't work.
 
I would like to sum each value resulting from the multiplication for each loop iteration. I have attached the labview file here. Please let me know what I'm doing wrong.
 
Thanks.
[]~.~[]
0 Kudos
Message 1 of 3
(2,132 Views)
This is a duplicate post, to follow this thread go to http://forums.ni.com/ni/board/message?board.id=170&message.id=251346&jump=true

Paul
0 Kudos
Message 2 of 3
(2,112 Views)

You can delete your Build Array Function and move the Add Array Elements Function outside of the while loop.  Wire the output from Multiply through a tunnel in the while loop and use this as the input to the Add Array Elements Function.  Be sure that you have enabled indexing.  If you have not, you will get a broken wire when you try to make the connection.  To change whether or not indexing has been enabled or disabled, you can right-click the tunnel.  This should produce the sum of the array elements in the sum indicator.

Good luck!

NIKatie
0 Kudos
Message 3 of 3
(2,109 Views)