Re: Reading data.
- To: mathgroup at smc.vnet.net
- Subject: [mg21151] Re: Reading data.
- From: Bojan Bistrovic <bojanb at physics.odu.edu>
- Date: Fri, 17 Dec 1999 01:22:02 -0500 (EST)
- Organization: Old Dominion Universityaruba
- References: <831v6a$g49@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Madhusudan Singh wrote:
>
> I have a data file with 7 columns and 100 rows. How do I import data from
> that into 7 different arrays in Mathematica ? The data is in exponential
> form and is tab separated. Top few rows are shown at the end of this
> posting.
>
> -------------
> The cut and paste has junked up the things a bit. But there are 7 columns
> and 100 or so rows.
> -----------
>
> Second question : how do I do a linear fit of of one column as x and
> another as y ?
>
> What is the format of such an output ?
>
Lets asume the data are in the file called "filename". You do the
following:
In[1]:= f1=OpenRead["filename"];
In[2]:=
table1=Table[Read[f1,{Real,Real,Real,Real,Real,Real,Real}],{100}];
In[3]:= table2=Transpose[table1]
and you'll get a table with 7 elements, each a table with 100 elements
coresponding to the columns in your file. This assumes that the
"filename" is in a place where mathematica can find it.
--
-------------------------------------------------------------
Bojan Bistrovic, bojanb at physics.odu.edu
Old Dominion University, Physics Department, Norfolk, VA
-------------------------------------------------------------