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: 

Moving Average From Data File

Solved!
Go to solution

Hi,

 

I'm trying to do a subvi that counts any jumps in the data points.

The algorithm:

--construct an array of samples (of the size round(FPS/2))

--Take the mean

--subtract the data points of the array from the mean: difference=absolute(data point-mean).

--compare the difference to the threshold: if difference>=thershold then add 1 to the counter.

 

The subvi (jump detect) is going to be used in a larger vi, and I need to make sure that it's working. But it's not working now....

While the vi is running and everything is calculated, it doesn't count the jumps which are clearly seen on the plot.

Any ideas what am I doing worng?

 

Thank you,

 

 

Download All
0 Kudos
Message 1 of 5
(2,879 Views)

A couple more attachements....

Download All
0 Kudos
Message 2 of 5
(2,878 Views)

Anyone?

0 Kudos
Message 3 of 5
(2,850 Views)
Solution
Accepted by topic author simply_me

The problem exsist in your for loop in your subVI. At this point you are iterating through FPS/2 size of array, and you are only outputing the last value of all of your calculations. Unless the very last value is flagged as a jump, it won't be logged. You can easily fix this by putting shift registers on your for loop, the only issue is doing something with your boolean flag. You could index the boolean values and then do an Or Array function, but that part is up to you.

 

Changes.png

National Instruments
Applications Engineer
Message 4 of 5
(2,816 Views)

Hi Scott,

 

Thank you for the corrections, I really appreciate it.

 

0 Kudos
Message 5 of 5
(2,802 Views)