Sum

(Engine-Level Function)

Description: Returns the arithmetic sum of all the valid array elements in a specified portion of a numeric array.
Returns: Numeric
Usage: Script or steady state.
Function Groups: Array,  Generic Math
Related to: AMin | AValid | FiltHigh | FiltLow | FitOffset | FitSlope | Mean | SDev | SumBuff | Variance
Format: Sum(ArrayElem, N)
Parameters:  
ArrayElem
Required. Any array element giving the starting point in the array. The subscript for the array may be any numeric expression. If processing a multidimensional array, the usual rules apply to decide which dimension should be used.
N

Required. Any numeric expression giving the number of array elements to use, starting at the element given by the first parameter. N cannot be greater than the array size.

If the sum of N plus the starting element is greater than the size of the array, this computation will "wrap-around" and resume at element 0, until N elements have been processed.

Comments: Invalid array elements are not included in the calculation. The function returns an invalid result if either of its parameters is invalid, if there are no valid numerical array elements in the specified range, or if the number of elements to use is 0.

Example:

data[0] = 1;
data[1] = Invalid();
data[2] = 1.5;
data[3] = 3;
data[4] = 100;
dataSum = Sum(data[0], 4);

The value of dataSum is 5.5.