MeshGrid
Get 2-D grid matrices based on the coordinates contained in vectors vX and vY. mX is a matrix where each row is a copy of vX, and mY is a matrix where each column is a copy of vY. Both mX and mY have vX.GetSize() rows and vY.GetSize() columns.
BOOL MeshGrid(const vector & vX, const vector & vY, matrix & mX, matrix & mY)
Return TRUE on successful exit and FALSE on failure.
EX1
void matrixbase_MeshGrid_ex1() { vector vX = {1,2,3}; vector vY = {4,5}; matrix mX, mY; int ii, jj; bool bVectorCheck = MeshGrid(vX, vY, mX, mY); // print the meshgrids matrices mX and mY if (bVectorCheck) { printf("mX = \n"); for(ii=0; ii<mX.GetNumRows(); ii++) { for(jj=0; jj<mX.GetNumCols(); jj++) { printf("%f ",mX[ii][jj]); } printf("\n"); } printf("mY = \n"); for(ii=0; ii<mY.GetNumRows(); ii++) { for(jj=0; jj<mY.GetNumCols(); jj++) { printf("%f ",mY[ii][jj]); } printf("\n"); } } }
matrixbase::GetSubMatrix