Re: (how?) notebooks with I/O loop
- To: mathgroup at smc.vnet.net
- Subject: [mg40275] Re: (how?) notebooks with I/O loop
- From: "John Jowett" <John.Jowett at cern.ch>
- Date: Sat, 29 Mar 2003 05:19:18 -0500 (EST)
- Organization: CERN
- References: <b5rme7$eum$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jason, You can do all this very comfortably within a Mathematica notebook. Without knowing the details of your problem, here is a schematic: First go to the appropriate directory and get the names of the data files in a list. I assume they have file extension ".dat": SetDirectory[ ...] dataFiles=FileNames["*.dat"] Define a function to all the work on one file and save the result in a file with a different extension processDataFile[fn_String]:=Module[{ result }, result=yourAnalysis[fn]; Save[StringReplace[fn,".dat"->".out"],result] ] Then treat all the files Scan[processDataFile,dataFiles] This assumes that the result is some kind of Mathematica expression and you would be happy to get that expresssion saved in a file. I suspect you might want a notebook for each input file, containing plots, tables, etc. That is also possible - see functions like NotebookPut, SelectionEvaluate, .... I'm sorry I don't have time to think through the details. John Jowett "Jason Miller" <millerj at truman.edu> wrote in message news:b5rme7$eum$1 at smc.vnet.net... > Dear Mathematica Gurus. > > I am working with a student (undergraduate math major) who is using > Wavelet Explorer to process numerous datasets using a multiresolution > analysis with various parameter settings. We would like to know how > we might create a notebook that would > (1) read in a datafile from a list of files in a local > directory (or in a hardcoded array), > (2) run a multiresolution analysis on the file (this analysis > is already coded), > (3) save the results (e.g., in the form of a mathematica notebook), and > (4) do the same in turn for each of the datasets in a local > directory, as described in (1). > Having a way to create such a 'loop' would save us much time, but > we're don't know how to direct Mathematica to save the results of > each analysis. > > Can anybody tell us how we might do this, or if it's a reasonable thing to do? > > Thank you in advance. > > Jason > -- > Jason Miller, Ph.D. > Division of Mathematics and Computer Science > Truman State University > 100 East Normal St. > Kirksville, MO 63501 > http://vh216801.truman.edu/millerj > 660.785.7430 >