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

Home » Public Forums » archive » Re: Ascii-import
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: Ascii-import [message #32070 is a reply to message #32027] Thu, 12 September 2002 08:06 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
Thomas Jordi <tschordi@giub.unibe.ch> writes:

>> There are much easier ways to read this kind of data
>> than READ_ASCII. Here is an example using the COUNT_ROWS
>> program you can find on my web page:
>>
>> num_rows = Count_Rows(filename)
>> data = StrArr(num_rows)
>> OpenR, lun, filename, /Get_Lun
>> ReadF, lun, data
>> Free_Lun, lun
>>

> Thanks to both of you. As the ascii_read didn't work I first posted,
> then thought.
> This is how i finally resolved it (with w eq filename):

> OPENR, unit10, w, /GET_LUN
> buf=''
> count=0
> WHILE (NOT EOF(unit10)) DO BEGIN
> READF, unit10, buf
> count=count+1
> ENDWHILE
> CLOSE, unit10 & FREE_LUN, unit10
> img=STRARR(count)
> OPENR, unit9, w, /GET_LUN
> READF, unit9, img
> CLOSE, unit9 & FREE_LUN, unit9

> some sort of countrows...

> tnx again

> Thomas

You can also do this in one pass through the file with something like the
following.

OPENR, unit10, w, /GET_LUN
buf=''
count=0
WHILE (NOT EOF(unit10)) DO BEGIN
READF, unit10, buf
count=count+1
if count eq 1 then img = buf else img = [img, buf]
ENDWHILE
FREE_LUN, unit10

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Simple animation?
Next Topic: CW_Animate procedure...

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

Current Time: Tue Dec 02 07:36:55 PST 2025

Total time taken to generate the page: 0.00214 seconds