Matrix::IsValid
IsValid
Description
Checks the validity of this Matrix.
Syntax
BOOL IsValid( )
Parameters
Return
Returns TRUE if this Matrix is valid and FALSE if this Matrix is not valid.
Examples
EX1
// Determin a Matrix if it is valid, or not
void Matrix_IsValid_ex1()
{
matrix<double> mat1 = {
{1, 1, 1, 1},
{2, 4, 6, 8},
{3, 6, 9, 12}
};
String MatWinName,MatLyName;
Matrix Mat1;
printf("<< Test whether an internal Matrix \"Mat1\" is valid, or not >>\n");
MatrixPage MatPg1;
MatPg1.Create("Origin");
MatWinName=MatPg1.GetName();
printf(" Matrix window %s has been created, but NOT attached yet....\n",
MatWinName);
MatrixLayer MatLy1 = MatPg1.Layers(0);
MatLyName=MatLy1.GetName();
if(Mat1.IsValid())
printf(" Mat1 is already Valid.\n");
else {
printf(" Matrix Mat1 is NOT valid yet, i.e., not attached to a window layer.\n");
Mat1.Attach(MatLy1);
Mat1 = mat1;
printf(" Matrix Mat1 is attached to a matrix window layer %s, and assigned the values...\n",
MatLyName,MatLy1.GetName());
if(!Mat1.IsValid())
printf(" Now, Mat1 is still NOT valid.\n");
else
printf(" Now, Mat1 is Valid as attached to %s in %s.\n",
MatLyName,MatWinName);
Mat1.Detach();
printf(" Mat1 has been Detached from %s....\n", MatLyName);
if(Mat1.IsValid())
printf(" Now, Mat1 is still Valid.\n");
else
printf(" Now, Mat1 is NOT valid.\n");
}
}
Remark
Checks the validity of this Matrix. Matrix objects not attached to an internal Origin matrix object are not valid.
See Also
Matrix::Attach, Matrix::Detach, Matrix::Matrix
header to Include
origin.h
|