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

Home » Public Forums » archive » Re: read multiple files with varying names
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: read multiple files with varying names [message #66661 is a reply to message #66600] Thu, 28 May 2009 07:44 Go to previous message
sophie.hoss is currently offline  sophie.hoss
Messages: 5
Registered: May 2009
Junior Member
yup, thanks.. i deleted the post like 10min after i wrote it, cause i
found the solution myself. you guys were obviously quicker.

however, the next problem came right along..

i'm trying to read in a fair big amount of radiation ascii-files (12
colums, roughly 5000 rows each file), which have as i wrote in my
last, deleted post, all different names. I guess the name problem is
solved.
below you find the code i'm using. and i cannot find out why it gives
me the error "READF: End of file encountered" (comes up in the line
marked with ****). i'm very aware that this is a common error and i
went over and over it again. with moderate success...

here's part of the code:

CD, 'filepath'
ci_files = FILE_SEARCH('ci*', COUNT=num_ci_files_found)

for i = 0,(num_ci_files_found-1) do begin

file = ci_files(i)

; Get number of rows in file
rows = File_Lines(file)

; Open file, read header
OpenR, lun, file, /Get_Lun
header = StrArr(34)
ReadF, lun, header
Point_Lun, -lun, currentLocation

; Read the first line and get number of columns
line = ""
ReadF, lun, line
cols = N_Elements(StrSplit(line, /RegEx, /Extract))

; variable to hold the data
data = strarr(cols, (rows(i)-N_Elements(header)))


rows_data = rows - n_elements(header)
stop
s=strarr(cols)
n=0
while (~ eof(file) and (n lt rows_data -1 )) do begin
; Read a line of data
readf,lun,s
; Store it in data
data[*,n]=s
n=n+1 (*****)
end
data=data[*,0:n-1]


I did the while-loop because I learned that IDL might not read every
line separately. Don't know if it's the most elegant version but at
least it is one.

for the sake of my sanity, any help is appreciated!
cheers,
sophie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Am I having a blackout?
Next Topic: How to extract latitude and longitude information from HDF file?

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

Current Time: Wed Oct 08 18:22:18 PDT 2025

Total time taken to generate the page: 0.00184 seconds