[Date Index] [Thread Index] [Author Index]
Re: possible?: Notebook in "batch mode"
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.