Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1994

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

Search the Archive

Re: formatted data

  • To: mathgroup at (mathgroup)
  • Subject: Re: formatted data
  • From: ianc (Ian Collier)
  • Date: Fri, 1 Jul 1994 08:31:34 -0600

Patrick Bradshaw <bradshaw at> asks:

>Sorry if this is an often-asked question, but I was wondering if there was
>a way (a package?) to read in a formatted data file (using like a "formatted
>read" statement from Fortran).
>For example, if a line of the data looks like
> 47950  4 9450
>I would like to read the data into a list looking like
>        {47.950, 4., 9.450}
>I looked through MathSource and didn't find anything, but perhaps I
>overlooked something.


You can do this with the built-in command ReadList. Herew is an example,
using the option RecordLists -> True which causes each line of the input
file to be placed on a separate sublist.

        !!readtest     (* First look at the file *)
47950  4 9450
75320  2 8310
23093  6 9234

        ReadList[ "readtest", Number, RecordLists -> True]
        {{47950, 4, 9450}, {75320, 2, 8310}, {23093, 6, 9234}}

I hope this helps,


  • Prev by Date: Re: Are these good books?
  • Next by Date: Alternative to Timing[10000!] benchmark
  • Previous by thread: Re: Are these good books?
  • Next by thread: Re: formatted data