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 #66659 is a reply to message #66601] Thu, 28 May 2009 08:25 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
sophie.hoss@gmail.com wrote:

> 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

Sophie,
when reading strings, the whole line is read. So when you read in S, you
are reading nb_cols LINES.. s[0] = line0, s[1] = line1 etc. You would
have to read the whole line then separate the columns.

You can do it in one step

data = strarr(nbLines)
readf,lun,data

Jean
[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: Fri Oct 10 07:14:56 PDT 2025

Total time taken to generate the page: 1.19807 seconds