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

Home » Public Forums » archive » read ascii
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
read ascii [message #63629] Mon, 17 November 2008 02:20
julia.walterspiel is currently offline  julia.walterspiel
Messages: 35
Registered: July 2008
Member
hi

i've been fiddling about this problem the whole morning and it seems I
can't get it done properly:

I'm trying to read in a huge (!) ascii-file ('test.dat') where the
first column is a string (name of station), followed by 2 columns with
integer values (second row date in the format yymmddhourminute, third
row integer numbers between 0 and 10).

example 'test.dat':
SMA 200001010010 0
SMA 200001010020 0
SMA 200001010030 1
SMA 200001010040 0
SMA 200001010050 3
SMA 200001010100 4
SMA 200001010110 5
SMA 200001010120 0
SMA 200001010130 0
SMA 200001010140 0

no header.

I don't know how many rows I got, but I'm sure it's a LOT, since excel
crashes when trying to copy the file :)

I'm using David's Code like this:

OPENR, lun, '/filepath/test.dat', / GET_LUN

station = strarr (1000000)
time = fltarr (1000000)
sunshine_duration = fltarr(1000000)

s = '???' --> not sure what to insert here
t = 0.0
sd = 0.0
count = 0

WHILE (NOT EOF(lun)) DO BEGIN
READF, lun, s, t, sd
station(count) = s
time (count) = t
sunshine_duration(count) = sd
count = count+1
ENDWHILE

station = station(0:count-1)
time = time(0:count-1)
sunshine_duration = sunshine_duration(0:count-1)

FREE_LUN, lun

then I get the error
"READF: Input conversion error. Unit: 101"
I tried to google this error but couldnt find any useful
information...

I figure, I don't understand 100% what I'm doing here, that's why I
don't see where I make the mistake...
furthermore, I'm not sure how the file is delimited (tab or white
space) if this is crucial to anything..?

any help appreciated!
cheers,
juls
[Message index]
 
Read Message
Previous Topic: Re: bake a cake
Next Topic: Re: how to draw contour with continue color?

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

Current Time: Fri Oct 10 10:58:44 PDT 2025

Total time taken to generate the page: 0.16395 seconds