MathGroup Archive 2001

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

Search the Archive

Re: select data in formatted datafiles


These are your tab - delimited data (5 columns):

In[1]:=
data = ReadList["tabdata.txt", Number, RecordLists -> True]
Out[1]=
{{1.3, 2.6, 0.3, 9.27, 8}, {4, 5.2, -4, 0.45, 22}, 
  {4, 6.4, -12, 0.13, 1}}

These are the columns you want to work with (say,1 and 4):

In[2]:=
cols = {1, 4}; 

This is the result:

In[3]:=
Transpose[(Transpose[data][[#1]] & ) /@ cols]
Out[3]=
{{1.3, 9.27}, {4, 0.45}, {4, 0.13}}

Tomas Garza
Mexico City
----- Original Message ----- 
From: "Fabrice Gautheron" <fabrice.gautheron at cern.ch>
To: mathgroup at smc.vnet.net
Subject: [mg31395] [mg31379] select data in formatted datafiles


> Hello,
> 
> I am interested to analyse data from a tab formatted datafile. I need to
> apply a function for one or two column(s) only over a total of 5
> columns. The ReadList command shows the format {data1, data2, data3,
> ...},{data1, data2,...}, ..
> 
> How to request only one or two columns (data2 column or data2 ar data5
> columns for example)?
> 
> Many thanks in advance
> 
> Fabrice
> 
> 



  • Prev by Date: Re: graphics on the same line
  • Next by Date: Re: Finding variables in a very long expression
  • Previous by thread: select data in formatted datafiles
  • Next by thread: Re: select data in formatted datafiles