Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: 3d table or list to file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34896] Re: [mg34879] 3d table or list to file
  • From: "Y.A.Tesiram" <yas at pcomm.hfi.unimelb.edu.au>
  • Date: Wed, 12 Jun 2002 02:15:25 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
Some examples on using Export, Import and Readlist pasted below. There
are subtle differences, when using Import. Best to check with small examples to
verify that what you want is what you get. My apologies for the extra
formats introduced by Mathematica during the copy paste part. I have
indicated where the quotation(" ") marks are needed.

In[21]:=
example1 = {{1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}};

In[2]:=
?Export

"Export[\"file.ext\", expr] exports data to a file, converting it to a
format \
corresponding to the file extension ext. Export[\"file\", expr,
\"format\"] \
exports data to a file, converting it to the specified format."

In[27]:=
Export["file.txt", example1, "List"]  (* double quotes needed around
file.txt and List only *)

Out[27]=
"file.txt"

In[29]:=
ReadList["file.txt"] (* double quotes needed here *)

Out[29]=
{{1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}}

OR

In[34]:=
Import["file.txt", "List"] (*Likewise here*)

Out[34]=
{"{1,", 1, 1, "1}", "{2,", 2, 2, "2}", "{3,", 3, 3, "3}", "{4,", 4, 4,
"4}"}

OR

In[34]:=
Import["file.txt", "List"] (* Ditto for double quotes*)

Out[34]=
{"{1,", 1, 1, "1}", "{2,", 2, 2, "2}", "{3,", 3, 3, "3}", "{4,", 4, 4,
"4}"}

OR

In[35]:=
Import["file.txt"]

Out[35]=
"{1, 1, 1, 1}\n{2, 2, 2, 2}\n{3, 3, 3, 3}\n{4, 4, 4, 4}\n"d



On Tue, 11 Jun 2002, Shawn O'Connor wrote:

> Is it possible to save 3D lists to file to recall them later.  Export/Import
> does not seem to work for lists with dimensions greater than 2
>
> Thank you.
>
>
>



  • Prev by Date: Re: "TableLabel"?
  • Next by Date: Integrate using UnitStep[*]
  • Previous by thread: Re: 3d table or list to file
  • Next by thread: Re: 3d table or list to file