Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: Q: Processing file in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7641] Re: [mg7627] Q: Processing file in Mathematica
  • From: seanross at worldnet.att.net
  • Date: Tue, 24 Jun 1997 03:36:04 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Lubosh wrote:
> 
> I am relatively new to mathematica, only using simple features. I need to
> process a file in mathematica, and output it into a file again.
> More specifically the steps needed to be peformed in a cycle are:
> 1. Read the file - 5 numbers at a time - one row of a table
> 2. Perform an operation (FFT) on those 5 numbers
> 3. Output the result into another file.
> 
> I would greatly appreciate if someone can give me a simple solution to this.
> 
> Thanks,
> Lubosh
> *******If emailing back please Watch The SPAMStopper*********************
> --
> Lubosh Hanuska
> Division of Psychology
> ANU
> *****************SPAMstopper in the email address !!!
> 
> Please add the country extension  .au  to the email address when replying !!!
> 
> ******************************************************************************


No need to do it only 5 numbers at a time, make the whole input file
into a table with:

mydata=ReadList["datafile",{Number,Number,Number,Number,Number}];
myfft=Map[Fourier,mydata]; (*this does an fft on each row of the data*)
streamout=OpenWrite["myoutputfile"];(*opens a channel for the output
file*)
Write[streamout,myfft];
Close[streamout];Clear[streamout];

There are certainly other ways to do this task.  Check out the commands
WriteAppend and section 2.10 of the mathematica book on file i/o.

Aside from that, why would you want to do an fft on only 5 points?  The
results certainly wouldn't mean very much.  Was this only a test case?


  • Prev by Date: Q:SetCoordinates[system] usage
  • Next by Date: Re: Replace expressions
  • Previous by thread: Q: Processing file in Mathematica
  • Next by thread: Intelligent handling of Infinity in Limits