From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of numbers difference with specific sampling time

Solved!
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.

 

Qun

0 Kudos
Message 1 of 2
(2,522 Views)
Solution
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.

 

Alain

0 Kudos
Message 2 of 2
(2,477 Views)