Declaration: 
TDataTable.MeanVarOfNumCells (LowCol, LowRow, HighCol, HighRow: integer; var Mean, Variance: double): integer; 
The method MeanVarOfNumCells calculates the mean and the variance of all matrix elements within a specified range of cells which are neither marked as csNAN, nor as csUndefined and which belong to either interval or ratio scaled variables (that is "real" numbers, see also the section on nominal and ordinal data). The range of matrix elements to be used is determined by the parameters LowRow, LowCol, HighRow, and HighCol. If any of these parameters receives an invalid value, this value is automatically adjusted to the nearest boundary value (either 1 or NrOfColumns / NrOfRows).
The variable parameters Mean and Variance return the mean and the variance of the selected data. The function returns the number of data points used for the calculation (i.e. the number of numeric data cells within the specified range).

Hint 1: 
If there are less than three values within the specified range of the matrix, the calculation of the variance is impossible. In this case a value of 1.0 is assigned to the variable Variance. 
Hint 2: 
Setting both the low and high parameter of a dimension (i.e. LowCol and HighCol) to zero values forces the method to use all elements of that dimension. 
Hint 3: 
The function MeanVarOfNumCells assumes that the values
used for the calculation of the variance are sample data. If you have to
calculate the variance of a population (i.e. all values ever measured) you
have to multiply the variance by a factor of n/(n1), with n
being the number of values used for the calculation: n = (HighRowLowRow+1)*(HighColLowCol+1). 
Example: 
The statement Mat1.MeanVarOfNumCells (1,2,12,20,Mean,Vari); calculates the mean and the variance of all matrix elements with the indices [1,2] to [12,20], and returns them in the variables Mean and Vari.

