0
|
2738 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

# ToExpression and decimal separators?

Posted 10 years ago
 i'm  a little confused a puzzled when it comes to the following : list  {{"1,78 ", 323}, {"1,78 ", 3371}, {"1,77 ", 20}, {"1,79 ",   10}, {"1,77 ", 400}, {"1,78 ", 600}, {"1,77 ", 1140}, {"1,77 ",   90}, {"1,77 ", 10}, {"1,75 ", 50}, {"1,77 ", 1900}, {"1,77 ",   1490}, {"1,77 ", 10}, {"1,75 ", 3407}, {"1,74 ", 1500}, {"1,74 ",   4500}, {"1,74 ", 323}, {"1,75 ", 3000}, {"1,75 ", 3623}, {"1,75 ",   1377}, {"1,75 ", 1000}, {"1,75 ", 800},....} For example :Map[Head, Take[%, {15}], {2}] and its out :{{String, Integer}} . Why I can not convert string for real when using ToExpression ?
4 Replies
Sort By:
Posted 10 years ago
 Thank You for steering me  towards right direction.
Posted 10 years ago
 Oh, I see, it is complaining about the decimal separator. Perhaps something like ToExpression[MapAt[StringReplace[#, "," -> "."] &, list, {All, 1}]] ?
Posted 10 years ago
 pomitr2 = N[ToExpression[list[[All, {1}]]]] out ---ToExpression::sntx: Invalid syntax in or before "1,78 ". I want all fractions to be recognised as numbers for further calculations .
Posted 10 years ago
 Are you looking for something like N[ToExpression["123"]]?