I have a matrix
Mat B(480,640,CV_32FC1);
containing floating values..I want to write this matrix to a file which could be opened in notepad or M
use write binary :
FILE* FP = fopen("D.bin","wb");
int sizeImg[2] = { D.cols , D.rows };
fwrite(sizeImg, 2, sizeof(int), FP);
fwrite(D.data, D.cols * D.rows, sizeof(float), FP);
fclose(FP);
then you can read in in matlab read size and then reshape (type=single)
fp=fopen(fname);
data=fread(fp,2,'int');
width = data(1); height = data(2);
B = fread(fp,Inf,type);
imageOut = reshape(B,[width,height])';
fclose(fp);