Re: Q:ReadList is reading spaces with numbers - what do I do?
- To: mathgroup@smc.vnet.net
- Subject: [mg11102] Re: [mg11077] Q:ReadList is reading spaces with numbers - what do I do?
- From: seanross@worldnet.att.net
- Date: Sun, 22 Feb 1998 14:55:28 -0500
- References: <199802190132.UAA28118@smc.vnet.net.>
Tony wrote:
>
> Hello, and sorry for a very "un-Mathematica" like post. I'm just having
> a problem with Mathematica's file reading capabiliites that I've not
> had in the past.
>
> I am running Mathematica 3.0 for Linux.
>
> When I define:
>
> myres = ReadList[
> "dsbok.ton",{Number, Number, Number, Number, Number, Number,
> Number}]
>
> I get:
>
> {{ , ,24496 ,1285 ,3310 ,31648 ,9203 },{2 ,2 ,
> 23598 ,1391 ,3230 ,31648 ,9123 }, ....etc ....
>
> }
>
> wheilst in fact, the top of "dsbok.ton" has:
> 1 1 24496 1285 3310 31648 9203
> 2 2 23598 1391 3230 31648 9123 In other words, ReadList is
> skipping the first 2 1's, and not taking the space as a word-separator.
>
> I have tried:
> Reading words rather than Numbers;
> Using WordSeparator -> {" ","\t"};
> Reading another file.
>
> None of these has worked. the _really_ frustrating thing is that I think
> that this procedure worked a month ago on just the same bits of data!
> Has anyone run into and solved this problem?
>
> Tony
When all else fails with ReadList, I read the whole file in as a single
string and then manipulate the results with the string manipulation
commands and ToExpression at the end. I have seen weird behavior with
ReadList similar to that which you describe. --
Remove the _nospam_ in the return address to respond.
- References:
- Q:ReadList is reading spaces with numbers - what do I do?
- From: Tony <uctpjac@ucl.ac.uk>
- Q:ReadList is reading spaces with numbers - what do I do?