MathGroup Archive 1998

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

Search the Archive

Re:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15196] Re:
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Tue, 22 Dec 1998 04:01:30 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Here is an example which might (or might not) be like what you want:

In[1]:=
square[inputfile_String,outputfile_String]:=
  Module[{temp1,temp2},temp1=ReadList[inputfile];
    temp2=OpenWrite[outputfile,FormatType->OutputForm];
    Write[temp2,temp1^2//TableForm];Close[temp2]]

for example if "numbers" is a file containing   the numbers 1,2,3,4
(each on a separate line) then square["numbers","squares"] will give a
file "squares" containing the squares of your numbers, again each on a
separate line. You can vary this to deal with different types of data
in your input file, including numbers separated by commas etc.

Andrzej

On Fri, Dec 18, 1998, Don Keefer <dkeefer at isgs.uiuc.edu> wrote:

>Good Morning,
>
>I'll make this as short as possible - I have written a function that
>reads in a list of data, modifies it, and writes it out to an external
>file.  I would like to be able to specify the output filename as a
>parameter to the function.  In other words:
>f[x_,y_,outfile_]:=
>(yatta;
>yatta;
>yatta;
>yatta>>outfile)
>When I try this is doesnt work - it just names the outfile "outfile". 
>How can this be done?
>Thanks, 
>J.Russell
>******************************************************** Don
>Keefer				dkeefer at isgs.uiuc.edu
>Groundwater Geology Section		217-244-2786
>


Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp/
http://eri2.tuins.ac.jp/



  • Prev by Date: Re: Combinations
  • Next by Date: mathamatica help
  • Previous by thread: Re: Cuboid & RotateShape
  • Next by thread: mathamatica help