MathGroup Archive 2002

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

Search the Archive

RE: RE: 3d table or list to file

  • To: mathgroup at
  • Subject: [mg34969] RE: [mg34949] RE: [mg34879] 3d table or list to file
  • From: "DrBob" <majort at>
  • Date: Sun, 16 Jun 2002 00:24:03 -0400 (EDT)
  • Reply-to: <drbob at>
  • Sender: owner-wri-mathgroup at

The self-documenting file idea is a lot simpler this way:

resultfile = "restest.txt";
threedlist = {1, {2, {3, 4}}};
f[x_] := Sin[x]
SetAttributes[f, Listable]
Save[resultfile, {resultfile, threedlist, f}]

ClearAll[threedlist, f]
?? f

Save writes assignment statements (and other definition information,
such as Attributes) for a series of variables.  Save puts no semicolon
at the end of assignment statements, but when you Get the file later,
that doesn't cause any problems, as the file content isn't a compound
expression; the statements are separated by newlines.

Save appends definitions to the current content of the file, so you may
sometimes want to use DeleteFile to empty the file before writing new
definitions.  In case of a function like f above, that could be
important, because you'll otherwise Get old pattern definitions along
with the newest.

Bobby Treat

-----Original Message-----
From: Ingolf Dahl [mailto:f9aid at] 
To: mathgroup at
Subject: [mg34969] [mg34949] RE: [mg34879] 3d table or list to file

Just another method, that I like:

resultfile = "c:/restest.txt";
    StringForm["threedlist = ``;\n", InputForm[threedlist]]];

This gives a file with the content

threedlist = {1, {2, {3, 4}}};

that is written in the Mathematica language and can be read directly by

<< "c:/restest.txt"

By using this method, by writing the output as easily readable
files, you get easily "self-documented" files, that do not need
about the meaning of the content stored somewhere else. (Such
information is
called "Exformation" in the notation of the danish philosopher Tor
Nørretranders.) You can easily modify your Mathematica file to include
data or comments. You can also easily interpret, read and change the
file by
a text editor, or reuse the data in other ways. If you just store the
without some labelling or comments, you cannot as easy attach more
information, or as easy change the output format, without reformatting
data files you already have written. I have found this method with
self-documented data files very useful in storing experimental "raw
and also used other languages (e.g. Basic) to write such files. Then I
experiment freely with different ways of evaluation of my raw data,
destroying the raw data as such.

Ingolf Dahl
Chalmers University

-----Original Message-----
From: Shawn O'Connor [mailto:soconnor at]
To: mathgroup at
Subject: [mg34969] [mg34949] [mg34879] 3d table or list to file

Is it possible to save 3D lists to file to recall them later.
does not seem to work for lists with dimensions greater than 2

Thank you.

  • Prev by Date: RE: Experimental`FileBrowse
  • Next by Date: Trace a function
  • Previous by thread: RE: 3d table or list to file
  • Next by thread: Line and Text in Graphics