Quantcast
Channel: DIAdem topics
Viewing all articles
Browse latest Browse all 3196

Rowwise max/min function, similiar to ChnAverage?

$
0
0

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


Viewing all articles
Browse latest Browse all 3196

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>