comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Problem to read some data.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Problem to read some data. [message #68434 is a reply to message #68420] Mon, 26 October 2009 04:56 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
jkeller writes:

> Just use the quoted code above. This should read the data into
> variable 'a'. It will be as fast as it could be when reading text
> files with IDL.

Well, not necessarily. READ_ASCII *does*, necessarily,
use a FOR loop. If the data were all numerical (no strings),
or regularly spaced (so you could use a FORMAT statement),
then it would be much faster to allocate an array of floats
(or whatever) and read the data all at once in the IDL way.

Of course, if you don't know the number of columns and rows,
then you have to allocate time to find those things out.
For example, File_Lines has to read the entire file to count
the number of EOL markers in the file to determine how
many rows there are. But, still, even with this overhead
it is often (almost always?) faster to read data the IDL
way than to use READ_ASCII. That is the main reason I've
never used it. Even taking into account the five lines
of code you need to type, doing so was faster than waiting
for READ_ASCII to finish!

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What is the problem ?
Next Topic: plot some data with a legend

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 10:00:05 PDT 2025

Total time taken to generate the page: 1.51510 seconds