2
$\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$

1 Answer 1

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

(*   ==> {2.34411E3, 222.334E-6} *)
$\endgroup$
2
  • $\begingroup$ I thought a similar thing is possible with CForm but I failed to set it as Listable. $\endgroup$ Commented Mar 1, 2014 at 22:31
  • $\begingroup$ @Sjoerd C. de Vries Why doesn't this work with DecimalForm ? $\endgroup$ Commented Mar 13, 2023 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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