Avg

Calculates the average value of a set of numbers.

Function Group Execution Windows Embedded Thin Client Mobile Access
Avg Statistical Synchronous Supported Supported Supported Supported

Syntax

  Avg( numValue1, numValue2, … , numValueN )  Avg( "tagArray", numSample, optNumIgnore )  
Note: This function has two formats:
  • If the first parameter is a numeric tag or value, you must use the Avg( numValue1, numValue2, … , numValueN ) format.
  • If the first parameter is an array tag in double-quotes or a string tag, you must use the Avg( “tagArray”, numSample, optNumIgnore ) format.
numValue (1…N)
Integer or Real tags containing the numbers to be averaged together.
tagArray
Name of array tag (Real or Integer) containing the values to be averaged.
numSample
The number of array elements to be averaged.
optNumIgnore
Optional Integer or Real tag containing the value to be ignored in calculating the average.

Returned value

Returns the average of the values.

Examples

Tag Name Expression
Tag Avg( 1, 2.34, 5, 7, 4, 8, 9.4 ) // Returned value = 5.248571
Tag Avg( 1, 5, -9, 0, 5, 3 ) // Returned value = 0.833333
Tag Name Expression
Tag Avg( “tagArray[1]“, 3 ) // If tagArray[1]=10, tagArray[2]=20 and tagArray[3]=60, then the Returned Value = 30
Tag Avg( “tagArray[1]“, 3, 10 ) // If tagArray[1]=10, tagArray[2]=20 and tagArray[3]=60, then the Returned Value = 40

Avg