Ive been working on learning opencv by example and have learned lots but have some confusions/confusion in some parts, and would appreciate if you guys could help me out..

First off I have 5 matrices, and I want to combine them into one big matrix..

for this reason I converted them to row matrices, using the code:

CvMat row_header, *row, *row2;
	row = cvReshape(mat, &row_header, 0, 1);
	row2 = cvReshape(mat2, &row_header, 0, 1);
I then want to combine these into a single matrix, and for that I used:

cv::Mat M1(2,50,CV_32FC1);
	M1.row(1) = mat + 0;
	M1.row(2) = mat2 + 0;

	IplImage imgc = M1;
	CvMat *M2;
	M2 = cvCreateMat(2,50,CV_32FC1 );
	cvConvert(&imgc, M2);
	cvSave( "combined.txt", M2 );
but this does not seem to work.. I tried different variations of the code and none of them work, wont even compile but with the code i wrote above it does compile but then gives some runtime errors, when I ignore that it continues and executes, but below is the saved matrix:

rows: 2
   cols: 10
   dt: f
   data: [ -431602080., -431602080., -431602080., -431602080.,
       -431602080., -431602080., -431602080., -431602080., -431602080.,
       -431602080., -431602080., -431602080., -431602080., -431602080.,
       -431602080., -431602080., -431602080., -431602080., -431602080.,
       -431602080. ]
it does not look anything like the original matrices

help please.. how to i properly combine the matrices?

Thank you

P.S. mat and mat2 are just 2 simple matrices having 5 rows and 10 colums each.. im pretty sure my matrix combination method is at fault