MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Improt vs Get

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119928] Re: Improt vs Get
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 30 Jun 2011 06:30:07 -0400 (EDT)

On 6/29/11 at 5:29 AM, tsariysk at craft-tech.com (Ted Sariyski) wrote:


>{{X [m], -0.5066E+01, -0.4039E+01, -0.3012E+01},{Y [m], -0.5066E+01,
>-0.4039E+01, -0.3012E+01}}

>which I Get: fn = FileNameJoin[{myDir, "tst"}]

>In[]= Get[fn] Out[]=
>{{X[m],-0.377082,-0.097914,0.181254},{Y[m],-0.377082,-0.097914,0.
>181254}}

>which is not what I expect.

>Import, however, returns the content of tst:

>In[] =Import[fn,"List"] Out[]= {{{X [m], -0.5066E+01, -0.4039E+01,
>-0.3012E+01},{Y [m], -0.5066E+01, -0.4039E+01, -0.3012E+01}}}

>What do I miss here? Thanks in advance, --Ted

Get assumes everything it reads in is a Mathematica expression.
Import does not.

Specifically -0.5066E+01 is evaluated exactly as it would be if
you typed this into an input cell. That is as -0.5506 * E + 1.

Import converts the data according to what format you specify
and the options associated with that format. This additional
processing which is done by Import is why doing Import[file,...]
takes longer than Get[file] or ReadList[file,...]. It is also
this additional processing that allows Import to do what you
normally want with mixed data types.



  • Prev by Date: Re: Improt vs Get
  • Next by Date: can't Solve[1 - x == x^r, x]?
  • Previous by thread: Weighted Histogram
  • Next by thread: can't Solve[1 - x == x^r, x]?