Copy a subset of this matrix specified by 0 based column and row indices to a worksheet object
BOOL CopyTo( Worksheet & wksTarget, int r1 = 0, int c1 = 0, int r2 = -1, int c2 = -1, int nr1Wks = 0, int nc1Wks = 0, BOOL bTransposed = TRUE, BOOL bSetColumnTypes = TRUE )
Returns TRUE on successful exit and FALSE on failure.
EX1
// Extract a submatrix into a worksheet area void matrixbase_CopyTo_ex1() { BOOL rc, bTransposed = FALSE, bSetColumnTypes = TRUE; matrix mat1 = { {2,2,2,2,2}, {2,1,1,1,2}, {2,1,1,1,2}, {2,2,2,2,2} }; MatrixPage MatPg1; MatPg1.Create("Origin"); MatrixLayer MatLy1 = MatPg1.Layers(0); Matrix Mat1(MatLy1); printf(" Original matrix %s has been created.\n",Mat1.GetName()); Mat1 = mat1; Worksheet Wks1; Wks1.Create(); Dataset myXDs(Wks1,0); Dataset myYDs(Wks1,1); String strWksName = Wks1.GetName(); // Copy (2,2)-(3,4) submatrix to the worksheet from the 3rd row, // change bTransposed or bSetColumnTypes to see the result rc=mat1.CopyTo(Wks1, 1, 1, 2, 3, 2, 0, bTransposed, bSetColumnTypes); if(!rc) printf(" Error: CopyTo on %s failed.\n",Mat1.GetName()); else printf(" Extracted submatrix from (2,2) to (3,4) has been copied to the 3rd row of %s.\n",strWksName); }
origin.h