Select the Segment of a Channel Greater Than a Threshold using DIAdem Script

Updated Mar 10, 2020

Issue Details

I have made a measurement and have the results in a TDMS channel. However I am only interested in data points above a certain channel, let's say 3000. 
How do I create a copy of the channel that only includes data points above a limit using DIAdem script?

Solution

To achieve this you need to copy the original channel and then change the data points to be excluded to NoValue according to a specific condition.
The function CTNV to change converts a Boolean expression to NoValue or to 0. You can utilize this function and the rule that any operation with NoValue operand will also result in NoValue. You can see the steps below. 
Call Calculate("ch(""[1]/RPM_Filtered"")=ch(""[1]/RPM"")") 'create RPM_Filtered Channel as a copy of RPM channel'
R1=3000 'set threshold constant'
Call Calculate("CH(""[1]/RPM_Filtered"")=ch(""[1]/RPM_Filtered"") + CTNV((ch(""[1]/RPM_Filtered"")<R1))") 'replace elements below threshold with NoValue'

You can run this script using the Example.tdm file in DIAdem.

Additional Information

In case you would also like to delete the NoValue data point, please have look at How to Delete Zeros and NoValues from DIAdem Channel for more information on the topic.