09-07-2011 04:33 PM
Hello,
I have a 3 iteration For Loop which gives an array of 5 elements after its executed. With every iteration of the For Loop, how do I add each element to its previous value to form a final array of the elements' cummulative sum? For example:
Array values for 1st iteration: [A, B, C, D, E]
Array values for 2nd iteration: [F, G, H, I, J]
Array values for 3rd iteration: [K, L, M, N, O]
How can I make the Final Array to be a cummulative sum of i.e: [(A+F+K), (B+G+L), (C+H+M), (D+I+N), (E+J+O)]?
Your help will be apreciated, Thank you!
Solved! Go to Solution.
09-07-2011 04:54 PM
The Add function is polymorphic. Thus, if you feed it 2 1D arrays you'll get an array that is the sum of each element. With a loop you need to use a shift register or feedback node to keep track of the current sum.
For example:
09-07-2011 05:16 PM
Thanks, that works great! 🙂