Re: ReadList of Mixed Data Types???
- To: mathgroup@smc.vnet.net
- Subject: [mg12154] Re: ReadList of Mixed Data Types???
- From: "David Keith" <dkeith@hevanet.com>
- Date: Mon, 27 Apr 1998 01:46:38 -0400
- Organization: Hevanet Communications
- References: <199804170740.DAA00258@smc.vnet.net.> <6hrro5$h7c$2@dragonfly.wolfram.com>
"ToExpression" is also a technique I have used. In fact, I believe Todd
could read the comma delimited data as Words using ReadList with
WordSeparators->{","}, and then use ToExpression to convert the Words
to integers.
Unfortunately, this will not work for Reals expressed in Fortran
E-format. The problem is that while ReadList very conveniently
understands E-format, Mathematica in general does not, so neither does
ToExpression. I very frequently use Mathematica to process DOS text
format data files which have been stored by an HP semiconductor
analyzer, which really only wants to record comma delimited data.
What I *really* need is for ReadList to accept a WordSeperator->{","}
option when reading numbers - - - - but I would be very grateful to
anyone who could point me to a good work-around for this in Mathematica
3.0.
Thanks.
Sean Ross wrote in message <6hrro5$h7c$2@dragonfly.wolfram.com>...
>Todd A. Guillory wrote:
>>
>> I need to read this file into Mathematica:
>>
>> George Washington
>> 1732,2,22
>> 1777,12,15
>> 1778,1,20
>>
>> This is just a test, but the data file format HAS to be this way. I
>> also have to use ReadList. Don't ask!
>>
>> Anyway, I've tried several variations of ReadList with WordSeparator and
>> such NEVER get all the data, just parts.
>>
>> The first record is a string, the remaining three need to be 3-3 part
>> list of numbers.
>>
>> Any suggestions greatly appreciated.
>>
>> email tag@io.com
>
>
>I have also had trouble with ReadList, but I have a work around that has
>never failed me. I read the entire data file in as a string using
>Read[stream,String]. I then use the string manipulation commands to
>massage it into the correct format and use ToExpression at the end to
>convert it into a numerical expression. --
>Remove the _nospam_ in the return address to respond.
>
>
>
- References:
- ReadList of Mixed Data Types???
- From: "Todd A. Guillory" <tag@io.com>
- ReadList of Mixed Data Types???