I am calculating a few lists of values that I have in arrays. I want to export these into a tab-delimited text file that I can import into other programs for analysis, plotting and so on but I am struggeling for hours to produce a number format without any gimmicks. I just want regular floating point numbers.
Export[filename,Transpose[{results1, results2, results3}], "TSV"]
That is my naive approach that kind of works. But now some numbers happen to be integer values like 10000. This is printed as
10000.
which can't be read by the program because the decimal part is missing. I found that FortranForm
creates nicely usable numbers, but when I try to put that into the expression like
Export[filename,Transpose[{FortranForm[results1], FortranForm[results2], FortranForm[results3}]], "TSV"]
It prints stuff like
Transpose[{List(0.001,0.001584893192461114,0.0025118864315095794,0.003981071705534973, ...
into the file.
The export is done in a loop (filename is dynamically created) so I can't really do it by hand.
So my question is, how can I put regular numbers into a file? It can't be that complicated.
As pointed out in the comment section there is a very similar question already at: How to export data files using specific format
This is about getting a suitable format for Fortran in the exported data. That however is not enough in my case. That format is not completely valid for most other Windows programs. Furthermore the answers there do not treat the problem of where to implement the function.
The answer by andre given there however helps a lot, as I have pointed out in my answer to this question.
NumberForm
, the results can be tailored to allow for nearly any format in your exported data. $\endgroup$Export
function just printedNumberForm[10000.,10]
or something like that into the file. It was kind of like myFortranForm
example. Sorry for sounding a bit cranky by the way, I'm just completely confused at this point. $\endgroup$Export
set incorrectly. This question covers an issue related to makingExport
evaluateNumberForm
: problem with NumberForm export. $\endgroup$