MeanVar
Declaration: 
TMatrix.MeanVar (LowCol, LowRow, HighCol, HighRow: integer; var Mean, Variance: double); 
The method MeanVar calculates the mean and the variance of all matrix elements within a specified range of cells. 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 border value (either 1 or NrOfColumns or NrOfRows, respectively).
The variable parameters Mean and Variance return the mean and the variance of the selected data.

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 MeanVar 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.MeanVar (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.

