Showing results for 
Search instead for 
Did you mean: 

Array of numbers difference with specific sampling time

Go to solution

Hello everyone,


I try to calculate the difference of an array. The code out side the while loop generate number array. However, when I turn on the hightlight excution, I find the first there is a problem in the first step. I am thinking to use subvi like time delay or the shift register to fix the problem. Unfortunatly I still stuck there. Anyone can help me out, thank you.



0 Kudos
Message 1 of 2
Accepted by topic author chalkwu

If you want to subtract each element of an array with the previous element you'll always have a problem with the very first iteration since there is no 'previous' value.

So the best you can do is to initialize your shift-register with an appropriate value that will be used during the first iteration. That value is typically 0 but it may not be the best choice if for example your 'signal' has a big offset. Sometime re-using the first element is a better choice. See attached example.



0 Kudos
Message 2 of 2