Attach matrix object to internal Origin matrix
Attach a Matrix object to an internal Origin matrix by a MatrixLayer object.
BOOL Attach( LPCSTR lpcszMatrixName )
BOOL Attach( MatrixLayer & mlMatLayer, int nMatObj = -1 )
Returns TRUE if attachment is successful and FALSE if unsuccessful.
Returns TRUE if attachment is successful and FALSE if unsuccessful.
EX1
int Matrix_Attach_ex1() { // Assumes Matrix1 exists in Origin double dMean; Matrix matA; // Declare OC Matrix object matA.Attach("MBook1"); // Attach OC object to internal Origin matrix dMean = matA.GetMean(); // Use matrixbase::GetMean function printf("Mean of Matrix1: %g\n", dMean ); // Print out mean return 0; }
EX2
// Attach the Matrix object to the matrix layer void Matrix_Attach_ex2() { // Assumes a matrix window is active in Origin workspace MatrixLayer MatLy1; // Declare OC MatrixLayer object MatLy1 = (MatrixLayer) Project.ActiveLayer(); // Get active MatrixLayer from OC Project object Matrix Mat1; // Declare OC Matrix object Mat1.Attach(MatLy1); // Attach the Matrix object to the matrix layer //Matrix Mat1(MatLy1); // *** Note: Above 2 lines can be replaced with this line. *** matrix mat1 = { {1, 2, 3}, {4, 5, 6} }; Mat1=mat1; // Assigning the matrix values setting in the proper matrix sizes }
Attach a Matrix object to an internal Origin matrix by a MatrixLayer object.
Matrix::Detach,Matrix::IsValid,Matrix::Matrix
origin.h