[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with reading formated file



Pavel Eiges wrote:
> 
> Hello!
> 
> i'm new in IDL programming so my question may be very
> dumb/simple/funny/etc but i cant solve this problem by myself.
> 
> i have a formated file like this:
> ===========================
>    1877383765    1.778
>    1877384765    1.685
>    1877385765    1.599
>    1877386765    1.599
>    1877387765    1.685
> ===========================
> and i need to load it into two arrays. the first array is LONG-type,
> the second one - FLOAT-type. How i can do this?
> ("READF, file, Time, Data" does not work).
> 
> %-\ HELP!
> 
> Pavel Eiges



You must specify a format='(...)' statement with the READF command. In 
your case thi swoul dbe something like 

READF,file, time, data, format='(3X,i10,f9.3)'

Also, because time is a long variable, you may have to assign it to a
long value before you call READF, e.g. time=0L (well, you don't have to:
IDL converts it into a float if you don't. But this way you can save it
as a long variable if you like to).

Cheers,
Martin.



 
------------------------------------------------------------------------
Dr. Martin Schultz                   
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax  : (617)-495-9837
Please indicate name and room (186 Pierce) when sending a fax

e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------------------