LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help!!! Subtract Current value with Previous Value

Hello, all expert there.
 
Please help me to solve this simple but look complicated to me because i am not too familiar in using array (other method will do).
 
With 2 input number added together and stored into an 1D array everytime after i have pressed a button (inside a while loop), i would like to subtract the current value
with the previous value and display it(non array).
 
It's sound easy but it did take me quite soemtime to do it but still facing a lot of difficulties.
 
Please help me to solve this. Thanks for your help.
0 Kudos
Message 1 of 7
(4,787 Views)
What have you tried so far? If i understood you correctly, I'm assuming you have a shift register for your array. Since you're adding to the array all you need to do is index out the last element, which is the "previous" element after you've added the "current" element. Then, it's a simple subtraction:



Note that, technically, in the first iteration the indexing is undefined since the array is empty. This may not be an issue for you, though.


Message Edited by smercurio_fc on 02-20-2008 09:01 AM
0 Kudos
Message 2 of 7
(4,781 Views)
You must use a shift register. See attached example.
0 Kudos
Message 3 of 7
(4,774 Views)
And if you really need all the sums in an array...
0 Kudos
Message 4 of 7
(4,769 Views)

Thanks for your helps.

btw, JB, i cant open ur VI since i am using LABview 8.0. there is an error on opening the VI. can printscreen the b.diagram for me.

Thanks alot.

0 Kudos
Message 5 of 7
(4,746 Views)
It takes less time to save them to LV8.0...
Download All
0 Kudos
Message 6 of 7
(4,739 Views)
Thanks a lot JB. Thats wat i need.
Thank you as well smercurio_fc, it did help me.
 
Thanks.
0 Kudos
Message 7 of 7
(4,735 Views)