MathGroup Archive 2010

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

Search the Archive

Re: Convert string list to number list

Thanks to all who replied.  Even with ToExpression, I was trouble getting the string to numeric conversion to persistently take when replacing to a list. There was some weird runtime error where you could run and get: 

lstTriple =lstTriple/.{x_,y_,z_}->{x,ToExpression[y],z}





After splitting out the column containing numeric string data explicitly to a new single variable list, then running the Map function using ToExpression, and then reassembling the list triple, would Mathematica recognize the numeric and not string format persistently. 

Thanks again for the help. - Kurt 

----- Original Message ----
From: dh <dh at>
To: Canopus56 <canopus56 at>
Sent: Mon, January 18, 2010 4:06:33 AM
Subject: [mg106625] Re: Convert string list to number list

if you do not want it to convert on input, you may still use e.g. ToExpression:
ToExpression@{"00", "01", "02", "03", "04", "05", "06", "07"}

Canopus56 wrote:
> On importing a space delimited text file,  I have an extracted list of zero-padded two-digit integers in the form: Amylist{"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"}  How do I convert these to real numbers or integers? Thanks - Kurt  I have reviewed the Mathematica documentation and a few books looking for the equivalent of a simple string-to-number function like vba's "Value".  Could not find an answer. Thanks.      


  • Prev by Date: Re: More /.{I->-1} craziness, con brio
  • Next by Date: Re: First function debug help
  • Previous by thread: Re: Convert string list to number list
  • Next by thread: Re: Convert string list to number list