12-27-2009 04:14 AM
Hi,
I have a tricky problem: I would like to filter values which aren't in range of a two values e.g. max 400 min -200.
The evaluation unit shell filter the first index and the last index of the exceeding. I've attached a screenshot of my current
source code but my problem is, that if on the exceeding was found e.g. at index 1,2,3,4,6,7,8,50,51,63 - the algorithm should find
the max value from index 1-4, 6-8,50-51 and 63. When only one value was found the start index is also the end index. To easily find the event I want to also log a digital ramp from start to end index.
The problem of my attached source is that only one event per unit will be found. Has anybody a hint?
Thanks in advance.
Best Regards,
--
Joachim
Solved! Go to Solution.
12-27-2009 07:26 AM
If you want multiple results, you simply need to use a loop to find them all.
Can you attach an actual VI and some typical data instead of a picture?
12-28-2009 01:17 PM
The loop isn't the problem but the algorithm inside the loop: I have to compare the values in that array - element per element. I've attached a vi with demo data. The result should be an array of cluster with the max value+timestamp, start timestamp and stop timestamp.
Best Regards,
--
Joachim
01-07-2010 07:46 AM
hi,
is the demo enough? hasn't somebody an hint for me how to solve the problem?
Best Regards,
--
Joachim
01-07-2010 07:35 PM - edited 01-07-2010 07:37 PM
There are many ways to solve this, here's one simple possibility. (Just a draft, please check for bugs).
I replaced the timestamps with an integer ramp for easier debugging. Simply replace the integers with timestamps again.
(connect the timestamp array instead of the blue array to the loop and replace my clusters with your typedef again.)
01-08-2010 12:50 AM
Altenbach,
thanks for your help. It's great. One problem remains: if the value is negative (-400,-500,-600) the max value is the lowest one --> -400.
Best Regards,
--
Joachim
01-08-2010 01:20 AM
Joachim082 wrote:thanks for your help. It's great. One problem remains: if the value is negative (-400,-500,-600) the max value is the lowest one --> -400.
-400 is the largest of (-400,-500,-600) and thus the max! Right?
What else do you expect? 🙂
01-08-2010 01:46 AM
Altenbach,
no - in the negative range -600 is the max value. The unit is kNm. I need the maximum value of the amplitude.
01-08-2010 02:14 AM
Joachim082 wrote:no - in the negative range -600 is the max value. The unit is kNm. I need the maximum value of the amplitude.
No, it's not. I guess you want the largest absolute value, which is not the same as the plain max.
This also leads to more questions. For example if a range contains -290 and 280, which one would be the max???
Here's a quick trivial modification to the existing code that keeps the value with the largest absolute value for each subrange. See if this works for you. 😉
01-08-2010 02:20 AM
altenbach,
a range from -290 to 280 is impossible. I've always values between which aren't out of the min-max range. E.g. one trend could be 400,280,240,200,100,0,-120,-250,-300,0 --> min: -200 max: 250 --> 1. cluster element: {400,280; max: 280} 2. cluster element: {-250-300; max: -300}. This should be the result. I need the leading edges.
I will test the modified vi.
Thanks.