LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I determine if all values in a moving window/array are greater than x?

Solved!
Go to solution

Hi everyone,

 

I have a problem that is driving me batty.... I have a strain signal and would like determine strain "onset" threshold as the point at which the baseline mean value exceeds 3SD... This is ok, I calculate this fine... My problem is that I want to define (and find) the strain threshold onset as the point at which ALL elements within a moving window (length of 100 data points, step of 1 data point) are greater that the threshold value..... Hopefully this will reduce any false triggers, so to speak.. So for a 100 data point window, the outcome of the for loop with the 100 element subarray should be either 0 (1 or more elements DO NOT exceed the threshold) or 1 (ALL elements exceed the threshold).

 

I have made some subvis for calculating moving average RMS data and indexing values based on comparison functions (i.e. find all indices> 3); but I cannot merge elements from both subvis to give me want I need... MVC EMD and RTD attempt to solve this problem.

 

As an Exercise Scientist (no formal EE background at all) I am getting my head around basic labview programming concepts...Any help with this is problem would be greatly appreciated... I have spent 5 hours on this! Ahh!

 

Regards,

Jack

0 Kudos
Message 1 of 18
(3,432 Views)

Jack,

 

Something like this should do it.

 

0 Kudos
Message 2 of 18
(3,417 Views)
Hello; I make this program in the past for my project ,i think you can use it in your program ; this program take array and delete all values equal to X Value;
Forza Juventus
0 Kudos
Message 3 of 18
(3,398 Views)
Solution
Accepted by topic author jcannon

Here's a slightly more optimized method.  Eliminated the extra array and combined the loops done inside of the primitives.



GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 18
(3,391 Views)
Hello; I make this program in the past for my project ,i think you can use it in your program ; this program take array and delete all values equal to X Value;
Forza Juventus
0 Kudos
Message 5 of 18
(3,382 Views)

@moussadjenane wrote:
Hello; I make this program in the past for my project ,i think you can use it in your program ; this program take array and delete all values equal to X Value;

Which program you are talking about. If you have the code you are welcome to share the code

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 18
(3,377 Views)

Building both suggested techniques provides an interesting result when the timing of both is profiled. If all values of the array aren't greater than the threshold value they both take the same time, even for pretty large arrays (100,000 values). But if all the array values are in fact greater than the threshold then the one based on LabVIEW primitives (the first case) is 3 times faster on average. LabVIEW 2011, Windows XP, i5-250, 3Gb memory.

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 18
(3,367 Views)

@moussadjenane wrote:
Hello; I make this program in the past for my project ,i think you can use it in your program ; this program take array and delete all values equal to X Value;

You posted this twice, so you must think it is really important. However, this is a different problem and has nothing to do with the topic of this thread.

 

  • If you have a question, start a new thread.
  • If you think you found an especially efficient and cool solution, write a hugget.

A program that takes an array and deletes all values equal to x will probably only work well for integers, because in floating point the definition of equal is a bit of a problem in general. Does your program remove all array elements that match X, making the array smaller, or does it set all matching elements to zero? Plenty of efficient in-place solutions have been discussed here in the past, but please share your code if you think it is worth sharing.

 

 

0 Kudos
Message 8 of 18
(3,364 Views)

Also, don't forget the ptbypt functions.

0 Kudos
Message 9 of 18
(3,355 Views)

Hi everyone,

 

Thanks for all your replies... Wayne's and Crossrulz solutions both worth well.... I can't really notice the difference in timing between the different approaches in my instrument... The code is for offline data analysis, so an extra second or so doesn't really matter...

 

Everytime I think I am getting better using Labview, people post responses such as these that solve my problem using very eficient code using appropriates I am not aware.... My attempts are MUCH less efficient.... Back to kindy for me!

 

Thanks again.

Regards,

Jack

0 Kudos
Message 10 of 18
(3,343 Views)