Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Q:ReadList is reading spaces with numbers - what do I do?



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.



  • Prev by Date: Re plot graph
  • Next by Date: Column output to text file
  • Prev by thread: Q:ReadList is reading spaces with numbers - what do I do?
  • Next by thread: RE: Q:ReadList is reading spaces with numbers - what do I do?