1
$\begingroup$

I am having an issue about how to export data in its scientific form using Mathematica.

To be concrete, I define a list

alist = {2344. 1111111, 0.0002223344};
ScientificForm[%]
Export["test.dat", %]

but it turns out that doesn't work. Is there any other way to achieve this? Also, what can I do to control the number of digits exported?

Any idea?

$\endgroup$
6
$\begingroup$
Export["test.dat",
   NumberForm[
     alist, 
     NumberFormat -> (Row[{#1, "E", #3}] &), 
     ExponentFunction -> (3 Quotient[#, 3] &)
   ], 
   "Table"
]

(*   ==> {2.34411E3, 222.334E-6} *)
$\endgroup$
  • $\begingroup$ I thought a similar thing is possible with CForm but I failed to set it as Listable. $\endgroup$ – Gregory Rut Mar 1 '14 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.