Mean/Average
Description
Returns the average of a vector.
Notes:
|
Syntax
double Mean(dataset vd)
double Average(dataset vd)
Parameters
vd
- A range, dataset or column.
Return
Returns the average of specified argument.
Example
EX1
double aa=mean(col(A)); aa=; //Should return the average value of the specified column.
EX2
mean(A1:B11)
EX3
average(join(A1:A5, A11:A15))
EX4
Suppose you have signal data in column A and indexes stored in column B and C. Fill following formula in column D's F(x) cell
average(A[B:C])
to fill column D with average values of sub-range in column A, which range between indexes col(B)[i] and col(C)[i].
EX5
// create a new workbook with 3 columns newbook; wks.nCols = 3; // fill first 2 columns with datdasets col(A) = {18, 2, 3, 19, 10, 17, 15, 16, 14, 1, 4, 17, 1, 13, 6, 12, 21, 10, 1, 15}; col(B) = data(1,20); // search values of column A in column B, return the index; // then set column C with average of range from B1 to the row before returned index csetvalue col:=col(C) formula:="average(B[1:list(A[i],B)-1])"; // column C should fill with dataset {9, 1, 1.5, 9.5, 5, 8.5, 7.5, 8, 7, 0/0, 2, 8.5, 0/0, 6.5, 3, 6, 0/0, 5, 0/0, 7.5};