Skip to content
Snippets Groups Projects
Commit a27e3b7d authored by Markus Blatt's avatar Markus Blatt
Browse files

Make precision of writeMatrixToMatlab adjustable.

(Aplied patch of Matthias Wohlmut with a small modification that
resets the precision to the old value).
Thanks go to Matthias.

[[Imported from SVN: r1508]]
parent 47a5d4aa
No related branches found
No related tags found
No related merge requests found
......@@ -469,14 +469,20 @@ namespace Dune {
* \code
new_mat = spconvert(load('filename'));
* \endcode
* @param reference to matrix
* @param filename
* @param outputPrecision (number of digits) which is used to write the output file
*/
template <class MatrixType>
void writeMatrixToMatlab(const MatrixType& matrix,
const std::string& filename)
const std::string& filename, int outputPrecision = 18)
{
std::ofstream outStream(filename.c_str());
int oldPrecision = outStream.precision();
outStream.precision(outputPrecision);
writeMatrixToMatlabHelper(matrix, 0, 0, outStream);
outStream.precision(oldPrecision);
}
/** @} end documentation */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment