MathGroup Archive 2005

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

Search the Archive

Re: Read a delimited text file into a mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62071] Re: [mg62011] Read a delimited text file into a mathematica
  • From: ggroup at sarj.ca
  • Date: Thu, 10 Nov 2005 02:51:44 -0500 (EST)
  • References: <200511090845.DAA17366@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Wed, 9 Nov 2005 03:45:25 -0500 (EST), youngjin.michael at gmail.com wrote

> I am new to Mathematica and would like to know if I can read a
> delimited text file into a mathematica and work with it. I was gooling
> and reading the online help, but I could not find it.

Absolutely.  If Import is not appropriate, look at Get or Read.  Assuming your 
data is in a plain text file with columns separated by spaces, you can use 
something like the following:

data = Import["C:\\My Path\\data.txt","Table"];

If you want to plot the data in column 4 vs. column 1, you can use something 
like:

ListPlot[data[[All,{1,4}]]];

If you want to plot both columns 4 vs. column 1 and column 6 vs. column 2 on a 
single graph, you can use something like:

<<Graphics`MultipleListPlot
MultipleListPlot[ data[[All,{1,4}]], data[[All,{2,6}]]];

Take a look at the help for Import to see the multitude of file types you can 
import.


  • Prev by Date: Re: feature request: invert plot axes
  • Next by Date: Re: Re: Mathematica 1
  • Previous by thread: Read a delimited text file into a mathematica
  • Next by thread: Re: Read a delimited text file into a mathematica