10-16-2012 06:16 AM - edited 10-16-2012 06:18 AM
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
Solved! Go to Solution.
10-16-2012 07:07 AM - edited 10-16-2012 07:07 AM
Jack,
Something like this should do it.
10-16-2012 08:01 AM
10-16-2012 08:35 AM - edited 10-16-2012 08:39 AM
Here's a slightly more optimized method. Eliminated the extra array and combined the loops done inside of the primitives.
10-16-2012 08:55 AM
10-16-2012 09:02 AM
@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
10-16-2012 09:14 AM
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.
10-16-2012 09:20 AM
@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.
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.
10-16-2012 09:32 AM
Also, don't forget the ptbypt functions.
10-16-2012 10:21 AM
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