MathGroup Archive 2002

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

Search the Archive

How to read mixed-type data from external files?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37636] How to read mixed-type data from external files?
  • From: wfhsiao at libra.seed.net.tw (Wen-Feng Hsiao)
  • Date: Thu, 7 Nov 2002 06:41:22 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

Suppose the type of the second column is String, the others are numbers. 

In[1]:=!! data.csv
1,WEIGHT,97.5,1123,371,50,25,0.1,2.2046223
2,STATURE,797.5,1944,1385,50,25,0.1,0.3937008
3,VERTICAL GRIP RCH,957.5,2332,1674,50,30,0.1,0.3937008
4,FRONTAL GRIP REACH,337.5,831,580,20,10,0.1,0.3937008
5,LATERAL GRIP REACH,462.5,1108,773,25,15,0.1,0.3937008
6,STEP HEIGHT,207.5,942,572,25,15,0.1,0.3937008
7,SUPINE STATURE,897.5,1925,1441,50,25,0.1,0.3937008
8,STANDING CG F FEET,507.5,1075,810,20,15,0.1,0.3937008
...

I tried the following code, but in vain. Could someone help me this out?

snum = OpenRead["data.csv"]
data = ReadList[
    snum, {Number, String, Number, Number, Number, Number, Number, Number, 
      Number}]
Close[snum] 

Thanks a lot!

Wen-Feng Hsiao


  • Prev by Date: Open notebooks created in Window with Macintosh computers
  • Next by Date: Kalman Filter &Smoother, Subspace Identification
  • Previous by thread: Fwd: Open notebooks created in Window with Macintosh computers
  • Next by thread: Re: How to read mixed-type data from external files?