DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I count the number of non-NULL values in a channel?

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.

0 Kudos
Message 1 of 3
(4,033 Views)

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...

Message Edited by RVallieu on 03-11-2009 10:09 AM
Message Edited by RVallieu on 03-11-2009 10:09 AM
Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 2 of 3
(4,023 Views)

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

0 Kudos
Message 3 of 3
(4,019 Views)