2.2.3.9.32 matrixbase::GetMaxGetMax
Description
Returns the maximum cell value in the matrix.
Syntax
double GetMax( )
Parameters
Return
Returns the maximum cell value in the matrix (as a double).
Note that the missing values in the matrix are excluded from the computation.
Examples
EX1
// Compute the maximum value of cells of a matrix
void matrixbase_GetMax_ex1()
{
matrix<double> mat1 = {
{1, 1, 1},
{2, 3, 4}
};
// Output of this program will be like following:
// The maximum value of cells in Matrix1 is: 4 .
MatrixPage MatPg1;
MatPg1.Create("Origin");
MatrixLayer MatLy1 = MatPg1.Layers(0);
Matrix Mat1(MatLy1);
Mat1 = mat1;
double dMax;
dMax = Mat1.GetMax(); // Compute the maximum value by GetMax
printf(" The maximum value of cells in %s is: %g .\n",
Mat1.GetName(), dMax);
}
EX2
// Compute the maximum value of cells of a matrix including NANUMs
void matrixbase_GetMax_ex2()
{
matrix<double> mat1 = {
{-1, -1,-1},
{-2, -3,99}
};
mat1[1][2]=NANUM; // set row=1,col=1 to NANUM
// Input matrix is:
// {-1, -1, -1}
// {-2, -3 --}
//
// Output of this program will be like following:
// The maximum value of cells in Matrix1 is: -1 .
MatrixPage MatPg1;
MatPg1.Create("Origin");
MatrixLayer MatLy1 = MatPg1.Layers(0);
Matrix Mat1(MatLy1);
Mat1 = mat1;
double dMax;
dMax = Mat1.GetMax(); // Compute the maximum value by GetMax
printf(" The maximum value of cells in %s is: %g .\n",
Mat1.GetName(), dMax);
}
Remark
Get the maximum cell value in the matrix (as a double). Note that the missing values in the matrix are excluded from the computation.
See Also
matrixbase::GetMin, matrixbase::GetMean, matrixbase::GetMedian
Header to Include
origin.h
|