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

Home » Public Forums » archive » Re: Probably a really simple read_ascii quesion....
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: Probably a really simple read_ascii quesion.... [message #68147] Thu, 01 October 2009 10:51 Go to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
On 1 Okt., 15:59, hethomas <het...@googlemail.com> wrote:
> I am trying to read in a text file (which is in column format) using
> read_Ascii.  Most of my variables read in fine, with the exception of
> the "time" colum, where data is in HH:MM:SS format.  (IDL reads these
> in as 1.0000).  Anyone know how to get around this?
> I did try playing with ascii_template (although I don't really want to
> have to use it), but for some reason , won't work and gives me the
> error message:
> Variable is undefined: SCREEN_SIZE.
> Error occurred at: AT_WIDGET        1364 C:\RSI\IDL63\lib
> \ascii_template.pro
>                    ASCII_TEMPLATE   1690 C:\RSI\IDL63\lib
> \ascii_template.pro
>
> I have the annoying feeling that this can be answered
> straighforwardly, and I just can't see it! Thanks in advance....
>
> Helen

read_ascii is painful to use. It's simpler to use function like this:

function read_textfile,filename
n=file_lines(filename)
s=strarr(n)
openr,lun,filename,/get_lun
readf,lun,s
free_lun,lun
return,s
end

and deal with the strings yourself. For time formats, you can make use
of this for decoding:

IDL> t='12:34:26'
IDL> time=0d ;you have to declare a double in advance...
IDL> reads,t,time,format='(C(CHI,x,CMI,x,CSI))'
IDL> print,string(time,format='(C())')
Sat Jan 01 12:34:26 1

Greg
[Message index]
 
Read Message
Read Message
Previous Topic: Probably a really simple read_ascii quesion....
Next Topic: Re: histogram, how to trasfer from linear bins to logarithmic bin?

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

Current Time: Wed Oct 08 17:35:04 PDT 2025

Total time taken to generate the page: 0.00415 seconds