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


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

Re: Importing a file and extracting data

Started byW Craig Carter <ccarter@MIT.EDU>
First post2013-06-15 08:13 +0000
Last post2013-06-15 08:13 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#14883 — Re: Importing a file and extracting data

FromW Craig Carter <ccarter@MIT.EDU>
Date2013-06-15 08:13 +0000
SubjectRe: Importing a file and extracting data
Message-ID<kph7nu$2dk$1@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@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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web