DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging selected range based on value of another channel

I have one channel, X, with a bunch of integer values from 0 to 90. I also have another channel with various corresponding data, lets call it Y. I would like to find the average and standard deviation for all of the values in Y that have a 0 in its corresponding X row, then the same for all values in Y that have a 1 in its corresponding row and etc, all the way up to 90. Is there an easy way to do this? Perhaps there is a way to sort the data and put all the Y values into new channels that are grouped according to their X values?
0 Kudos
Message 1 of 3
(3,048 Views)

It´s absolutely no problem to get the average, min, max, counts or sum. But i'm sorry, not yet the standard deviation (@NI "may be a good idea").

The key is "ChnClassXRedXY" (in German: reduzierende Klassierung). This function was designed many years ago for angle-based measuring.

With DIAdem 10.1 the function "CClassXRedXY" was added, for the use with 2 X-channels (i.e. engine characteristics).

CU

Martin

0 Kudos
Message 2 of 3
(3,043 Views)

Hi Martin,

You have a couple of options.  You could indeed use the FormulaCalc() command to split out various rows from your data channel that all have the same index into a new data channel and do this for each index.  Alternatively, you could determine which rows contain a certain index, then use the StatBlockCalc() function to determine statistics from only these rows of your data channel:

Dim Channel, Msg

Channel = "[1]/Time"

For i = 1 To 22
  StatSel(i) = "No"
Next
StatSel(4)  = "Yes" ' Minimum
StatSel(5)  = "Yes" ' Maximum
StatSel(6)  = "Yes" ' Arith. mean
StatSel(14) = "Yes" ' Standard Deviation

Call StatBlockCalc("Channel", "1-13", Channel)
Msg = Msg & "Min = " & StatMin        & vbCRLF
Msg = Msg & "Ave = " & StatArithMean  & vbCRLF
Msg = Msg & "Max = " & StatMax        & vbCRLF
Msg = Msg & "Dev = " & StatDeviation
MsgBox Msg

Note that if you have DIAdem 10.1 you should loop up to 23,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 3
(3,029 Views)