DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Rowwise max/min function, similiar to ChnAverage?

Can someone recommend a method to calculate the max or min, at each point in time (row), from a list of channels?  Right now I am looping through the channel length and using ValMax.  Is there a fucntion similiar to ChnAverage but instead it calculates the max?

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.
dim i, j
dim Length: Length = ChnLength(CNo("[2]/Pressure"))

dim Max, Min

Call ChnAlloc("Maximum",Length)
Call ChnAlloc("Minimum",Length)

For i = 1 to Length
   Max = -100 
   Min = 100 
   For j = 2 to GroupCount
      Max = ValMax(ChD(i,Ch("["&j&"]/Pressure")),Max)
      Min = ValMin(ChD(i,Ch("["&j&"]/Pressure")),Min)
   Next
   Data.Root.ChannelGroups(1).Channels("Maximum").Values(i) = Max
   Data.Root.ChannelGroups(1).Channels("Minimum").Values(i) = Min
Next

Call ChnCharacterAll

0 Kudos
Message 1 of 2
(2,872 Views)

Hello DF_DJS.

 

Please try this:

 

Go to the ANALYSIS panel, chose "Statistics>Descriptive Statistics".

 

In the dialog for the "Descriptive Statistics" configuration, change the following settings:

"Row-oriented evaluation"

Pick all the channels you want to include in the min/max per row (line) calculation in the "Channels" field

Leave "Rows" at the default setting to include all rows of a channel.

Deselect everything, then select Min and Max in the dialog.

In the "Result Storage" tab, make sure that "Store results in channels" is selected.

 

Statistics.png

 

Hit "Calculate" or "OK" in this dialog, and you will receive two new channel in the DataPortal with the results you are looking for.

You can use the Script recorder to turn the process into a Script.

 

I hope that's what you were looking for,

 

      Otmar

Otmar D. Foehner
Message 2 of 2
(2,838 Views)