03-10-2009 03:35 PM
I want to count the number of non-NULL values in a channel. Is there an easy way to do that, other than using a loop to look at each value in the channel.
I am familiar with the following function:
CL("/Channel")
But, it counts all values in a channel, including the NULL (i.e. NOVALUE) ones. Some of my channels have intermittent NULL values in the middle of channels, and I want a way to count them. This could also be sort of be like the COUNTIF funtion in Excel.
Thanks,
Brian E.
03-11-2009 10:08 AM - edited 03-11-2009 10:09 AM
You can utilize the Command ChnNovHandle to remove the NoValue data points from the channel and then process the channel length.
I think if you structure the script correctly you can do this without actually changing the original data channel.
i.e. L1 = CL("ChnNovHandle( ""channel of interest"" ) " ) or something to that effect...
03-11-2009 11:01 AM
Hi Brian,
I am not aware of a built in function in DIAdem to count the non-NoValue entries in a data channel. I would suggest that you run a VBScript that uses the Channel Calculator to create a temorary channel with a 1 in every row that your data channel is not NoValue and 0 in every row that your data channel is a NoValue. Then the VBScript can use the "CCh()" function to calculate the sum of that channel. In general you would then delete the temporary channel, although if you wanted to repeat this process for N data channels of the same length, then you should instead retain and re-use the temporary channel for each data channel and only delete it at the end.
Brad Turpin
DIAdem Product Support Engineer
National Instruments