Re: possible?: Notebook in "batch mode"
- To: mathgroup at smc.vnet.net
- Subject: [mg29136] Re: possible?: Notebook in "batch mode"
- From: paulh at wolfram.com (P.J. Hinton)
- Date: Wed, 30 May 2001 23:28:23 -0400 (EDT)
- Organization: Wolfram Research, Inc.
- References: <9f2gph$88d$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Wed, 30 May 2001 10:07:45 +0000 (UTC), Harald von der Osten-Woldenburg <hvdosten at lb.netic.de> wrote: > is it possible to work in batch mode, using a Mathematica-Notebook? I > have tried something like math<Notebook.nb but without any success. > > I have to work on 800 data files, using: > > data = Import["02000.dat", "Table"] and > wfile=OpenWrite["02000-new.dat"] respectively within the notebook. This is an FAQ that has been addressed several times in this forum. You can find a detailed response at this URL: http://library.wolfram.com/mathgroup/archive/1998/Apr/msg00243.html > Also without any success I have tried to read in those filenames written > in another input file. Is this also not possible or must I do some > tricky construction? Or is it possible to work like > > math < Notebook.nb %Input-Parameter1 %Input-Parameter2 Why not create a plain text file with one file name per line and then use ReadList[] to read the names in as strings: listOfFileNames = ReadList["listoffilenames.txt", Word]; Then you can automate the task of reading and writing data with Scan[]. Scan[ ( data = Import[#, "Table"]; newfile = StringReplace[#, ".dat" -> "-new.dat"]; wfile = OpenWrite[newfile]; (* Insert additional operations here. *) )&, listOfFileNames ] -- P.J. Hinton User Interface Programmer paulh at wolfram.com Wolfram Research, Inc.