I have this code:
fortranFormDP[x_] :=
NumberForm[x, {17, 16},
NumberFormat -> (StringJoin[{#1, "d", #3} /.
"d" :> "d0" /; #3 == ""] &)];
normals={{-0.14609, -0.0840416, 0.985695}, {-0.213989, 0.112374,
0.970351}, {-0.147526, -0.00175264, 0.989057}};
data1 = fortranFormDP /@ normals
My goal is to export the List
data1
to a file in a "Table"
format. Apparently, it is not straightforward as:
Export["myfile", data1]
because this produces:
{-0.1460901681201728d0, -0.0840415712588872d0, 0.9856950223466470d0}
{-0.2139894236453848d0, 0.1123736099765570d0, 0.9703508119998420d0}
{-0.1475262293814966d0, -0.0017526366367021d0, 0.9890565908527670d0}
Which is definitely not "Table"
format. Although I did not find it anywhere, it looks like that Mathematica
is unable to generate "Table"
format from strings. What would probably work is to convert each sublist to one string separated by spaces or tabs. But there is a problem, if I do:
StringJoin/@data1
I get errors. (My plan was to do StringJoin[Riffle[data1," "]]
). The source of the errors is probably due to data1//FullForm
. I tried:
StringJoin/@(Evaluate@data1)
but it does not help.
How would I force evaluation of data1
? And is there an easier way to export "Table"
format if the data is strings?