An Origin C Matrix (upper case M) is a dynamically allocated and sized two dimensional array that is tied to an internal Origin matrix window. Matrix is a template class with a default type of double but a Matrix of any basic data type (including char, byte, short, word, int, uint and complex but not string) can be constructed using the syntax Matrix<type>. The Origin C Matrix class is used to access the data in an internal Origin matrix while the Origin C MatrixObject class is used for style related control of the matrix. Thus, the MatrixObject class has the same relationship with the Matrix class as the Column class has with the Dataset class. That is, an internal Origin matrix object (accessed by the MatrixObject class) holds a matrix data set (accessed by the Matrix class) just as a worksheet column (accessed by the Column class) holds a data set (accessed by the Dataset class). The data values displayed in the cells of an Origin matrix (referenced by a Matrix object) are typically referred to as Z values whose associated X values are linearly mapped to the columns of the matrix and whose associated Y values are linearly mapped to the rows of the matrix. The Matrix class is derived from the matrix and matrixbase classes from which it inherits methods and properties.
// Assumes Matrix1 exists in Origin
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