MathGroup Archive 2008

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

Search the Archive

Re: how to read such kind of list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91035] Re: how to read such kind of list?
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Mon, 4 Aug 2008 03:23:42 -0400 (EDT)
  • References: <g6449i$dka$1@smc.vnet.net>

863 wrote:
> Hi, I'm having troubles with read in such kind of list:(between the
> lines)
> _____________________________________________________________________________
> The stat results of Quantum Dots of file : D:\ProGram\qd 2.1.2\1.TXT
> 
> totally 110 QDs were segmented
> 
>   QD number per cm^2: 4.36659e+010 per cm^2
>          mean height: 5.292516 nm
>        mean diameter: 28.801531 nm
>        mean distance: 33.309811 nm
>        area coverage: 0.291367
>       volume density: 0.545079 nm^3 per nm^2
>     mean orientation: 1.271796 degree with x-axis
> mean MajorAxisLength: 28.372259 nm
> mean MinorAxisLength: 20.458377 nm
> 
> Diameter	Height	Area	MajorAxisLength	MinorAxisLength	Orientation
> CentroidX	CentroidY	Volume	Distance
> 30.654263	5.682305	738.025950	31.117139	23.106343	-1.622242	15.319892
> 215.548346	1593.049175	48.741649
> 26.082407	5.763518	534.300037	25.935928	20.248467	-27.230550	10.990649
> 349.057494	1109.325936	30.633786
> 16.992852	2.057310	226.789224	15.903377	11.404470	-80.582608	5.929246
> 419.606587	104.229902	32.471795
> 33.184213	5.232010	864.874160	33.258266	23.873106	2.544861	33.037368
> 170.140864	1416.598341	40.478731
> 34.698269	6.372842	945.595748	35.071694	25.066265	0.415529	35.679808
> 386.624306	1878.842938	27.901502
> 32.287176	6.186880	818.747538	31.862749	23.366885	-8.171290	36.054502
> 67.137732	1757.760754	51.324165
> ____________________________________________________________________________________
> 
>  I have dozens of such kind of lists and actually what i'm interested
> is the data not these letters.However i can't figure out by
> Read["**.txt",Number,RecordList->True]
> How to sovle this problem?
> I really appreciate your help.Thanks!
> 
I would tackle this by reading in the data as a list of strings:

ReadList[file,String]

The first few items of the resultant list could be handled individually 
to extract the numerical values - say by using a string pattern to 
extract just the number and the using ToExpression to convert the string 
to a number.

You could then use Drop to strip off the front of the list and leave 
only the array of numbers (I am assuming that the lines do not alternate 
in length as they appear to do, but that they are uniform lines of data.

This data could be converted thus:

Map[ImportString[#,"List"]&,remaininglist]

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Re: Method Option
  • Next by Date: Re: Sending Objects from Java - Mathematica
  • Previous by thread: Re: Workaround for an unexpected behavior of Sum
  • Next by thread: Re: Sending Objects from Java - Mathematica