Message Boards Message Boards


How to import numerical data in scientific notation?

Posted 10 years ago
2 Replies
1 Total Likes
I created and exported a .txt file from Mathematica which I created.
It includes some values in this form: 1.4444*^-6, so when I import them again to Mathematica, it doesn't read them as numerical data, and it doesn't allow me to work with them. How can I import the list with this data? Thanks
POSTED BY: omar ballester
2 Replies
You could import as strings and then apply ToExpression:
(s = {"1.123*^-8", "2.123*^-8", "3.123*^-8",
    "4.123*^-8"} ) // InputForm

(* {"1.123*^-8", "2.123*^-8", "3.123*^-8", "4.123*^-8"} *)

ToExpression[#] & /@ s

(* {1.123*10^-8,2.123*10^-8,3.123*10^-8,4.123*10^-8}*)
POSTED BY: C ormullion
When saving data, it's normally important to save that data in a specific format. If you don't save a something as a specific format, it will be hard to import it later. 

For simple data in Mathematica, you can use Put and Get. Put and Get store things as simple Mathematica expressions.
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract