Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14883

Re: Importing a file and extracting data

From W Craig Carter <ccarter@MIT.EDU>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Importing a file and extracting data
Date 2013-06-15 08:13 +0000
Message-ID <kph7nu$2dk$1@smc.vnet.net> (permalink)
References <20130614090456.3F8026B6C@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Importing a file and extracting data W Craig Carter <ccarter@MIT.EDU> - 2013-06-15 08:13 +0000

csiph-web