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


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

Re: Improt vs Get

From "Scot T. Martin" <smartin@seas.harvard.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Improt vs Get
Date 2011-06-30 20:57 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iuinvk$kvh$1@smc.vnet.net> (permalink)
References <201106250929.FAA20235@smc.vnet.net>

Show all headers | View raw


Ted,


Import[...,"List"] (as well as "CSV" and "Table") features some automatic translation of common numbers used by other languages. These include "E" used by many programs as well as "D" from Fortran, etc.


Get[...], by contrast, does a literal import. Your literal import in FullForm is:
In[3]:= FullForm[Hold[-0.5066E+01]]

Out[3]//FullForm= Hold[Plus[Times[-0.5066`,E],1]]

This is where the number -0.377082 comes from.


In summary, use Get[...] rarely and only for stuff generated and saved with in Mathematica, such as by DumpSave[...], packages, etc.

Use Import[...] for stuff made outside of Mathematica that you are importing into Mathematica.

Scot

________________________________________
From: Ted Sariyski [tsariysk@craft-tech.com]
Sent: Wednesday, June 29, 2011 05:29
Subject: Improt vs Get

Hi,
I have a file tst:

{{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

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


Thread

Re: Improt vs Get "Scot T. Martin" <smartin@seas.harvard.edu> - 2011-06-30 20:57 +0000

csiph-web