MathGroup Archive 2005

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

Search the Archive

Re: How to read a data file in text format?_from a new learner

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62354] Re: How to read a data file in text format?_from a new learner
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Tue, 22 Nov 2005 04:41:56 -0500 (EST)
  • References: <dls56u$nue$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

deepthinker schrieb:
>     I want to import a data file that produced by spectrometer into
> mathemathica and fit the data. The file is in text format ("data.txt").
> The data in the file is characters: first line:some descriptions.
> second line: 200, 45.5. third line: 201,44.3. and so on. If you open
> the file "data.txt", you will see:
> transmission ratio by UV-3150
> 200, 45.5
> 201,44.3
> 202,44.6
> 203,46.7
> ...
> 1,000,75.5
> 1,000,76.3
>
> How to import these data in to mathematica 5.0 and plot the figure?
> Thank you very much
>

I don't know if this is the best approach, but you can try the
following:

urlist=ReadList["myfile", Word, WordSeparators->{"\n",â??\t"," â??,â??,â??}]

Now remove the irrelevant entries in front of the list:

list=Take[urlist, {5,Length[urlist]}]

If you need pairs of theses values, use Partition

Partition[list,2]

Out={{200, 45.5},{201, 44.3}, . . ,{1000,76.3}}


Gruss Peter
-- 
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: Export[] to XLS
  • Next by Date: Re: Re: Confusing results with N[expr]?
  • Previous by thread: Re: Re: How to read a data file in text format?_from a new learner
  • Next by thread: Re: How to read a data file in text format?_from a new learner