Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6819

Re: how to get string in sci. notation to a number?

From A Retey <awnl@gmx-topmail.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: how to get string in sci. notation to a number?
Date 2011-11-29 12:41 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jb2jub$688$1@smc.vnet.net> (permalink)
References <jb2hum$5e0$1@smc.vnet.net>

Show all headers | View raw


Am 29.11.2011 13:07, schrieb 1.156:
> I've been able to get a text file with data into a list of strings
> of the following form:
>
> {{"4.998865e+000", "9.564453e-006"},
>    {"5.630450e+000", "9.194384e-006"},
>    {"6.113276e+000", "8.134170e-006"}}
>
> After many hours I've really gotten nowhere except that it's most
> likely done with ToExpression which works fine with simple decimal
> numbers in string form. Must I really split up the strings, suck out the
> exponents, and then multiply them out to be able to use these numbers in
> a ListPlot?
> Any hints would be appreciated.

this is somewhat hidden, but the functionality is in the import 
routines. Depending on what your file originally looked like it might be 
more elegant and efficient to import it's content directly to a list of 
numbers, but this should also work once you have a list as the above:

{{"4.998865e+000", "9.564453e-006"}, {"5.630450e+000",
    "9.194384e-006"}, {"6.113276e+000", "8.134170e-006"}} /.
  s_String :> ImportString[s, "Table"]

hth,

albert

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to get string in sci. notation to a number? "1.156" <rob@piovere.com> - 2011-11-29 12:07 +0000
  Re: how to get string in sci. notation to a number? A Retey <awnl@gmx-topmail.de> - 2011-11-29 12:41 +0000
  Re: how to get string in sci. notation to a number? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-29 12:56 +0000
    Re: how to get string in sci. notation to a number? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-30 08:25 +0000
  Re: how to get string in sci. notation to a number? Chris Degnen <degnen@cwgsy.net> - 2011-12-01 12:26 +0000
  Re: how to get string in sci. notation to a number? Ralph Dratman <ralph.dratman@gmail.com> - 2011-12-02 12:27 +0000
  Re: how to get string in sci. notation to a number? "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2012-01-09 08:16 +0000

csiph-web