Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Converting string to exprsn (FromDigits)' topicStudent Support Forum > General > Archives > "Converting string to exprsn (FromDigits)"

Next Comment >Help | Reply To Topic
Author Comment/Response
06/24/07 02:52am

I am trying to convert a string of the form "1010" into it's decimal-value expression.
The next step will be to write the resulting expression to a file using BinaryWrite:
str = "101001000100001000111111100000011111";
s = StringTake[str, 8]
s1 = FromDigits[s]
BinaryWrite[outstream, s1];
I get this error message:
"FromDigits::nlst : The expression 10100100 is not a list of digits."

I understood from wolfram documentation that the form FromDigits["string",b] should work, but obviously it does not. What would be the mose efficient way to convert the string into an expression?
(there is a lot of writing to do, so efficiency is crucial)

URL: ,

Subject (listing for 'Converting string to exprsn (FromDigits)')
Author Date Posted
Converting string to exprsn (FromDigits) Burt 06/24/07 02:52am
Re: Converting string to exprsn (FromDigits) YEHUDA BEN-S... 06/25/07 10:24am
Next Comment >Help | Reply To Topic