MathGroup Archive 2008

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

Search the Archive

Re: how to import a block of numbers which may touch each other by "-"

On 2/21/08 at 6:06 PM, p.wholey at (P.Wholey) wrote:

>hello, I have an data file which format is as below:

>title: a.file

>date: 12 10 2007

>total lines: 100000

>numbers per line: 5

>main data as below:

>190 -0.129 0.05772  -0.030 -0.00996
>190  0.071 0.01619   0.039  0.04558
>190  0.121-0.03730  -0.009 -0.00406
>190  0.000-0.00288   0.036  0.01329
>190  0.042-0.00979  -0.112 -0.04337
>190 -0.123 0.07222   0.068  0.04067
>... ... ...

>I want to quickly import the main data block as a list of numbers.
>My problem is the 2nd and 3rd column of data may touch each by the
>minus mark "-" and there are 100000 lines in this block. How can I
>do it with Version5.0.

I would read the data in using either

ReadList["a.file",String] or

This would give you a list of strings. Then mapping StringTake
to this list you could extract just those characters that formed
a given number and use ToExpression to convert that string to a
number. For example, if the first number was always the first
three characters, then


would put the first column of numbers into data.
To reply via email subtract one hundred and four

  • Prev by Date: IMS IMTEK mailing list
  • Next by Date: Some interaction in Mathematica 6.0
  • Previous by thread: how to import a block of numbers which may touch each other by "-"
  • Next by thread: squared norm in Mathematica