MathGroup Archive 2003

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

Search the Archive

Re: Import[ ] & ReadList[ ]; "Word" and "Record"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40402] Re: [mg40388] Import[ ] & ReadList[ ]; "Word" and "Record"
  • From: "neuron" <b90401114 at ntu.edu.tw>
  • Date: Fri, 4 Apr 2003 01:21:45 -0500 (EST)
  • References: <200304030645.BAA12695@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Thanks a lot for the answer of question 1
As for question 2
Sorry, I lost a word in question 2:
2.Are the two types "Word"& "Record"  have different meanings?



----- Original Message -----
From: "Bill Rowe" <listuser at earthlink.net>
To: mathgroup at smc.vnet.net
Subject: [mg40402] [mg40388] Re: Import[ ] & ReadList[ ]; "Word" and "Record"


> On 4/2/03 at 4:35 AM, b90401114 at ntu.edu.tw (neuron) wrote:
>
> >1. What's the difference between Import[ ] & ReadList?
>
> Basically, Import is pre-programmed to understand a lot of specific file
formats and ReadList isn't. The built in knowledge of Import about certain
file types makes it much simpler to read the data from these files into
Mathematica than would otherwise be the case. But there is a performance
cost associated with Import.
>
> To give a specific example, suppose you had a spreadsheet file save as a
tab deliminated file that contained a mixture of both numeric and
non-numeric data. Then
>
> Import[filename, "Table"] would read all of the data in correctly
maintaining the data structure. Numeric data would be read in as numbers
ready to use in further computation. OTOH,
>
> ReadList[filename, Number, RecordLists->True]
>
> would generate errors and fail when the non-numeric data was encountered.
The errors could be avoided with
>
> ReadList[filename, Word, RecordLists->True]
>
> but now all of the data would be type String and would not be ready for
further computations without additional programming.
>
> If the file had the same format but contained only numeric data,
>
> Import[filename,"Table"] and
> ReadList[filename, Number, RecordLists->True]
>
> would have identical results but ReadList would execute faster.
>
> >2.Are the two types "Word" and have different meanings?
>
> Not as far as I know.
>



  • Prev by Date: RE: bug with definitions?
  • Next by Date: Re: Re: multistep iterative methods
  • Previous by thread: Re: Import[ ] & ReadList[ ]; "Word" and "Record"
  • Next by thread: Re: Import[ ] & ReadList[ ]; "Word" and "Record"