05-05-2010 09:45 PM
Hi,
I need help to find the second high index for the data array, how can i do it??
Attach with the vi snippet.
Thanks and regards,
Simon
Solved! Go to Solution.
05-05-2010 09:52 PM
05-05-2010 10:27 PM
Hi,
Thanks for your suggestion here.
Somehow, if the highest 1 at last index & second highest at 2 last, then the second highest index not correct...(refer to attachment)
Thanks and regards,
Simon
05-05-2010 10:41 PM
You didn't completely follow Raven's Fan advice. You would add 1 if the second highest index after the deletion is greater than or equal to the index of the highest value. If the index is less then you don't add anything.
Aside: are you assuming that each value in the array is unique?
05-05-2010 10:42 PM - edited 05-05-2010 10:42 PM
You forgot to do the comparison to see where the 2nd highest index fell relative to the highest.
You add 1 only if the 2nd highest comes after the highest. You just added 1 regardless of position.
05-05-2010 10:59 PM
Hi guys,
Thanks for your helps here.
Maybe i still in sleeping mode & miss out so important line.
Fyi, the data array is come out from the magnitude of power spectrum, so believe should be unique..
Thanks once again.
regards,
Simon
05-05-2010 11:03 PM
simon76 wrote:
Fyi, the data array is come out from the magnitude of power spectrum, so believe should be unique..
Even so, it's quite possible that you'd get the same values for two or more elements, so that may be something you may want to consider handling. For example, if you get two elements that are both the highest value then the first Array Max and Min will find the first one. Once you delete it, calling Array Max and Min again will find the second instance of that same value, rather than the actual next highest.
05-06-2010 10:14 AM
Just an other way to do the same thing, quite simple an giving you also the index of the third, forth, and so on...
p.s. consider also the option of using a peak detection VI....
09-23-2017 04:50 AM
hello
can you please upload your vi?
09-23-2017 07:01 AM
Angela93 a écrit :
hello
can you please upload your vi?
Did you realized this is a 7 years old thread? It takes less than 2 minutes to replicate the code have you tried?
Note that there is a simpler way to do this using Sort Array_ogtk.vi from the OpenG toolkit but for large array the original method is probably more memory efficient.
Ben64