Showing results for 
Search instead for 
Did you mean: 

Add previous value to present value

Hi everyone,


Does anyone know on the block diagrams, in the function palette, if there is such an operator that adds a previous data value to the present data value? 


For example, if you were to get a value of 5 as a value before and then you get a value of 3.  How would I be able to loop it where it keeps adding the previous data to the present data?  So the total would be 8 and then if it were to loop again then 8 would be added onto the upcoming solution.  Thanks!



0 Kudos
Message 1 of 6

And this could loop for an unspecified amount of time....depending on the loop.  Thanks!

0 Kudos
Message 2 of 6

Would it be possible to use a Compound Arithmetic to add this somehow?  The problem is that the input is a string function....

0 Kudos
Message 3 of 6

Add a shift register to your loop. Place your value in it. Then wire your new value to it inside the loop. The next iteration will have the last value that was wired to it.

Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 6

Thanks Mark!  I'll give that a try.  Appreciate the help!

0 Kudos
Message 5 of 6

@JonRod wrote:

The problem is that the input is a string function....

You cannot "add" strings, you need to scan them into a numeric value first. Then use a feedback node as suggested.

0 Kudos
Message 6 of 6