09-30-2016 10:02 AM
Hello, I am using ChnPeakFind to find the location of the minimum value of a channel. However, ChnPeakFind fails to find the minimum when the minimum occurs at the beginning or end of a channel. Is this expected behaviour, or is this a bug?
10-03-2016 01:03 PM
Hello Russell,
It is expected. The ChnPeakFin
If you are simply looking for the minimum value you can use the ChnValMin or CMin functions which will just find the lowest value in the channel. Then, if what you ultimately want to find is the position from that value, you can use the PNo function to find it. Please refer to the links below.
http://digital.ni.com/public.nsf/allkb/DD069B95FB938C4286256FC8006A09CD
http://zone.ni.com/reference/en-XX/help/370858M-01/functions/functions/pno/
The PNo function will find the first index where the channel value matches the input so if you have the value is matches several times along the channel you will need to code the script in a way that it checks the remaining values after the index found.
Alternatively, you could use the ChnAreaInsert0Concat to insert a 0 before the first and after the last value (and then you can change those if required) so that the ChnPeakFin
http://zone.ni.com/reference/en-XX/help/370859J-01/comoff/chnareainsert0/
Hope it helps!
Regards,