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


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

Re: Improt vs Get

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Improt vs Get
Date 2011-06-30 20:56 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iuintn$kv1$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 6/29/11 at 5:29 AM, tsariysk@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.

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


Thread

Re: Improt vs Get Bill Rowe <readnews@sbcglobal.net> - 2011-06-30 20:56 +0000

csiph-web