MathGroup Archive 2005

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

Search the Archive

Re: How to read a data file in text format?_from a new learner


my pattern for reading files like these would be:

 thisFile = OpenRead["C:\\Documents and Settings\\Luc\\Desktop\\sample.txt"];
 data = ReadList[thisFile, String];
 Close[thisFile];

Then you need to remove the first line:
 data2 = Rest[data];

Then transform the strings into proper numbers:

 data3 = ToExpression[StringReplace[#, {"," -> "", " " -> ""}]] & /@ data2

Finally plot the data:

 ListPlot[data3, PlotRange -> All]









Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=6189#p6189
Posted through http://www.mathematica-users.org [[postId=6189]]



  • Prev by Date: Re: How to View Mathematica and Hardcopy Books
  • Next by Date: Re: How to read a data file in text format?_from a new learner
  • Previous by thread: Re: How to read a data file in text format?_from a new learner
  • Next by thread: Re: How to read a data file in text format?_from a new learner