I am trying to write on a file the table generated in this way:
error = ConstantArray[0, 3];
error[[1]] = ScientificForm[Sqrt[CovMat[[1, 1]] /. out[[2]]]];
error[[2]] = ScientificForm[Sqrt[CovMat[[2, 2]] /. out[[2]]]];
error[[3]] = ScientificForm[Sqrt[CovMat[[3, 3]] /. out[[2]]]];
Ris = out[[2]] /. Rule -> (#2 &);
par = out[[2]] /. Rule -> (#1 &);
Finale = MapThread[{#1, ScientificForm[#2], #3} &, {par, Ris,
error}] // TableForm
CovMat anf out are generated in a previoous part of the code (a NMinimize
). Typing Finale on the notebook I find:
M 4.35203*10^(10) 4.2566*10^(9)
\[Delta] 4.10847*10^(5) 2.12356*10^(4)
L 1.01689*10^(9) 1.30717*10^(16)
The problem is that in the file I find:
"M ScientificForm[1.7467449664329874*^11] \
ScientificForm[4.784135569792907*^9]
[\Delta] ScientificForm[606745.0359163599] \
ScientificForm[10326.21966853348]
L ScientificForm[2.788541796939519*^10] \
ScientificForm[1.5410843643505646*^18]"
I used Export
and
file = OpenAppend["out.txt"]
string = ExportString[Finale,"Table"];
WriteString[file, string]
WriteString[file, "\n"];
Close[file]
(I thought that ExportString
read the values as they are) but I cannot get rid of that ScientificForm
.
I suspect that I should use something like:
Export["file.dat", {elem1->expr1, elem2->expr2, ...}, "Rules"]
but I cannot find a way to express the rule.