{{-2.95,-1.99},{1.16284,-0.156402,0.702541}}
I export it:
Export["btbl2.dat", btbl2]
(the variable is btbl2.)
And then Import it as btbl3:
btbl3=Import["btbl2.dat"];
Here is what the first element, btbl3[[1]] looks like:
{{-2.95,,-1.99},{1.1628413272120999,,-0.15640196465950917,,0.7025406185687192}}
Note the double commas!
Che pasa?
Kevin
FWIW,
The above example works fine on my system (no double commas):
In[1]:= btbl2 = {{-2.95, -1.99}, {1.16284, -0.156402, 0.702541}}
Out[1]= {{-2.95, -1.99}, {1.16284, -0.156402, 0.702541}}
In[2]:= Export["btbl2.dat", btbl2]
Out[2]= "btbl2.dat"
In[3]:= btbl3 = Import["btbl2.dat"]
Out[3]= {{-2.95, -1.99}, {1.16284, -0.156402, 0.702541}}
In[4]:= $Version
Out[4]= "6.0 for Mac OS X x86 (64-bit) (February 7, 2008)"
Regards,
-- Jean-Marc
Kevin
Jean-Marc Gulliet wrote:
> FWIW,
>
> The above example works fine on my system (no double commas):
>
> In[1]:= btbl2 = {{-2.95, -1.99}, {1.16284, -0.156402, 0.702541}}
>
> Out[1]= {{-2.95, -1.99}, {1.16284, -0.156402, 0.702541}}
>
> In[2]:= Export["btbl2.dat", btbl2]
>
> Out[2]= "btbl2.dat"
>
> In[3]:= btbl3 = Import["btbl2.dat"]
>
> Out[3]= {{-2.95, -1.99}, {1.16284, -0.156402, 0.702541}}
>
> In[4]:= $Version
>
> Out[4]= "6.0 for Mac OS X x86 (64-bit) (February 7, 2008)"
>
> Regards,
> -- Jean-Marc
>
>
--
Kevin J. McCann
Research Associate Professor
JCET/Physics
University of Maryland, Baltimore County (UMBC)
1000 Hilltop Circle
Baltimore, MD 21250
>I have computed a vector function {Bx,By,Bz} as a function of
>{x,y,z}. For example, here is the first element in the collection:
>{{-2.95,-1.99},{1.16284,-0.156402,0.702541}}
>I export it:
>Export["btbl2.dat", btbl2]
>(the variable is btbl2.)
>And then Import it as btbl3:
>btbl3=Import["btbl2.dat"];
>Here is what the first element, btbl3[[1]] looks like:
>{{-2.95,,-1.99},{1.1628413272120999,,-0.15640196465950917,,0.
>7025406185687192}}
>Note the double commas!
While it is not immediately apparent to me why the double commas
occur, using Export/Import to write out a variable to be read
back into Mathematica at a later time is inefficient. If this
all that is to be done, using Put/Get is much more efficient.
The disadvantage of using Put to write out contents of a
variable to a file is the resulting file is not in a format
generally suitable for use with other programs. The advantage of
using Put and Get for this purpose, is the overhead resulting
from Import's need to check data types etc. is avoided.
Even more efficient than using Put would be using
DumpSave/DumpGet. However, the format used here is not portable
across different platforms using Mathematica.