MathGroup Archive 2000

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

Search the Archive

Re: How to get two values from a file into two lists?


Rob:

Assuming data.txt is in the right place, this should work, with X and Y
being the lists you want:

OpenRead["data.txt"];
{X, Y} = Transpose[ReadList["data.txt", {Number, Number}]];
Close["data.txt"];

Ken Levasseur
Math. Sciences
UMass Lowell

***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
Starting Sept 6:
Abstract Algebra I: an on-line course usingMathematica! 
See http://cybered.uml.edu/descriptions/cy_92.421.htm for details   
***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****

robpeterson at iname.com wrote:
> 
> I'm embarrassed to ask for help here since this must be so simple.
> But, I can't pull it off.  And there are many kind souls here that
> have taken the time to help me in the past.  I hope I'm not pushing my
> luck.....
> 
> I have a text file with x and y values, space delimited (Mathematica likes
> that I gather) with CR LF at the end of each pair:
> 
> x1 y1 <ret>
> x2 y2 <ret>


  • Prev by Date: Re: functional routine for {a, b, c, ...} -> {a - b, b - c, c - ...a}
  • Next by Date: Re: functional routine for {a, b, c, ...} -> {a - b, b - c, c - ...}
  • Previous by thread: How to get two values from a file into two lists?
  • Next by thread: Re: How to get two values from a file into two lists?