# 2.2.3.8.19 Matrix::SetYMax

## Description

Set the Y coordinate associated with the last row of the matrix.

## Syntax

BOOL SetYMax( double dYMax )

## Parameters

dYMax
[input] Input Y coordinate of last row

## Return

Returns TRUE on success and FALSE on failure.

## Examples

EX1

// Set and get the Y coordinate of the last row of a matrix
void Matrix_SetYMax_ex1()
{
// This sample code will print a message like below:
// Target matrix is Matrix1.
// Setting Y max value succeeded.
// Obtained Y max value is 1.23457e+008
// Check Y max value by Matrix:Set Dimensions menu command if it is 1.234570e+008.
//
BOOL rc;

double dYMax;
matrix<double> mat1 = {
{1,  2},
{3,  4},
{5,  6}
};

MatrixPage MatPg1;
MatPg1.Create("Origin");
MatrixLayer MatLy1 = MatPg1.Layers(0);
Matrix Mat1(MatLy1);
Mat1 = mat1;
printf("  Target matrix is %s.\n",Mat1.GetName());

rc=Mat1.SetYMax(123.4567E6);  // Use SetYMax to set the Y coordinate of last row
if(!rc) {
printf("  Error: SetYMax failed.\n");
return;
}
else printf("  Setting Y max value succeeded.\n");
dYMax = Mat1.GetYMax();   // Use GetYMax to get the Y coordinate of last row
printf("  Obtained Y max value is %g\n", dYMax); // Print out coordinate
printf("  Check Y max value by Matrix:Set Dimensions menu command if it is %e.\n",dYMax);
}

## Remark

In addition to the values displayed in the cells of an internal Origin matrix (nominally Z values), Origin matrices map X coordinate values to the columns and Y coordinate values to the rows of the matrix. The SetYMax function sets the Y coordinate associated with the last row of the matrix.