# 2.2.3.8.17 Matrix::SetXMax

## Description

Set the X coordinate associated with the right most column of the matrix.

## Syntax

BOOL SetXMax( double dXMax )

## Parameters

dXMax
[input] Input X coordinate of right most column

## Return

Returns TRUE on success and FALSE on failure.

## Examples

EX1

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

double dXMax;
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.SetXMax(123.4567E6);  // Use SetXMax to set the X coordinate of last column
if(!rc) {
printf("  Error: SetXMax failed.\n");
return;
}
else printf("  Setting X max value succeeded.\n");
dXMax = Mat1.GetXMax();   // Use GetXMax to get the X coordinate of last column
printf("  Obtained X max value is %g\n", dXMax); // Print out coordinate
printf("  Check X max value by Matrix:Set Dimensions menu command if it is %e.\n",dXMax);
}

## 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 SetXMax function sets the X coordinate associated with the rightmost column of the matrix.