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

MathGroup Archive 2000

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24901] Re: [mg24882] How to get two values from a file into two lists?
  • From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
  • Date: Sun, 20 Aug 2000 01:34:51 -0400 (EDT)
  • Organization: UMass Lowell
  • References: <200008190845.EAA09580@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?