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: RE: 3d table or list to file

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

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]
Get[resultfile]
threedlist
?? 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 fy.chalmers.se] 
To: mathgroup at smc.vnet.net
Subject: [mg34969] [mg34949] RE: [mg34879] 3d table or list to file

Just another method, that I like:

threedlist={1,{2,{3,4}}};
resultfile = "c:/restest.txt";
Open[resultfile];
WriteString[resultfile,
    StringForm["threedlist = ``;\n", InputForm[threedlist]]];
Close[resultfile];

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
the
command

<< "c:/restest.txt"

By using this method, by writing the output as easily readable
Mathematica
files, you get easily "self-documented" files, that do not need
information
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
more
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
data
without some labelling or comments, you cannot as easy attach more
information, or as easy change the output format, without reformatting
all
data files you already have written. I have found this method with
self-documented data files very useful in storing experimental "raw
data",
and also used other languages (e.g. Basic) to write such files. Then I
can
experiment freely with different ways of evaluation of my raw data,
without
destroying the raw data as such.

Ingolf Dahl
Chalmers University
Sweden

-----Original Message-----
From: Shawn O'Connor [mailto:soconnor at ccs.nrl.navy.mil]
To: mathgroup at smc.vnet.net
Subject: [mg34969] [mg34949] [mg34879] 3d table or list to file


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