I have been trying my heart out to figure what is wrong with my code. I am trying to sort a matrix, and then copy the last row of the sorted matrix. I cant view the contents in debugger (vs2015/vc++) so I need to save the contents to the disk, but I keep getting the error "No element name has been given" which I suspect is the result of an incorrect copy operation for the last row of the sorted matrix.
cv::Mat sortedIndices;
cv::sortIdx(Matrix, sortedIndices, CV_SORT_EVERY_COLUMN + CV_SORT_ASCENDING);
cv::sort(Matrix, Matrix, CV_SORT_EVERY_COLUMN + CV_SORT_ASCENDING);
auto cols = Matrix.size().width-1;
auto maximums = Mat::zeros(1,cols+1,Matrix.type());
Mat onlyRow = maximums.row(0);
Matrix.row(Matrix.size().height - 1).copyTo(onlyRow);
cv::FileStorage file("G:/3.txt", cv::FileStorage::WRITE);
file << maximums;