DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnPeakFind with first and last values

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? 

0 Kudos
Message 1 of 2
(3,055 Views)

Hello Russell,

 

It is expected. The ChnPeakFind command searches for peaks by comparing a value with its left and right neighbors. So, the first and last values from the channel will never be identified as a maximum or minimum value.

 

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 ChnPeakFind would work.

 

http://zone.ni.com/reference/en-XX/help/370859J-01/comoff/chnareainsert0/

 

Hope it helps!

 

Regards,

Camilo V.
National Instruments
Message 2 of 2
(3,015 Views)