MathGroup Archive 2013

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

Search the Archive

Re: Importing a file and extracting data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131163] Re: Importing a file and extracting data
  • From: W Craig Carter <ccarter at MIT.EDU>
  • Date: Sat, 15 Jun 2013 04:21:08 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20130614090456.3F8026B6C@smc.vnet.net>

Hello Howard,
Perhaps incorporating something like this?

StringCases["Tc_Naph_84_2C", DigitCharacter]

ToExpression@StringCases["Tc_Naph_84_2C", DigitCharacter]

Total[{10, 1, .1} ToExpression@StringCases["Tc_Naph_84_2C", DigitCharacter]]


Generalizing as long as the last digit is always the first decimal---and there are no other numbers in your string.

toT[string_] :=
 Module[
  {temp = ToExpression@StringCases[string, DigitCharacter]},
  Total[N@Table[10^i , {i, -1, Length[temp] - 2}] Reverse[temp]]
  ]

toT["Tc_Naph_85_2C"]


W Craig Carter
Professor of Materials Science, MIT



On Jun 14, 13, at 5:04 AM, howardfink at gmail.com wrote:

> I have a series of files of this form:
>
> June 7, 2013     
> Tc+Naphthalene  vs Temperature (oC)
>
> Run 1
> Tc_Naph_84_2C			3.740 ns
>
> staring, without a clue how to get the 84_2 converted to the number 84.2,etc. and ending up with two lists: Run 1 and Run 2, consisting of pairs of temperature and time.  The temperature will eventually be converted to 1/abs



  • Prev by Date: Re: Importing a file and extracting data
  • Next by Date: Re: Position
  • Previous by thread: Importing a file and extracting data
  • Next by thread: Re: Importing a file and extracting data