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

Home » Public Forums » archive » Re: End of File-Error message in simple readf routine - What's the problem?
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: End of File-Error message in simple readf routine - What's the problem? [message #55343 is a reply to message #55341] Sun, 19 August 2007 17:41 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Aug 19, 4:53 am, b...@uni-mainz.de wrote:
> Hello,
>
> i'm sorry to post a new message, but i did not find the answer to my
> question, when i searched for it (or i did not use the fitting words
> for the search).
>
> I try to read the values of a file with three columns and 2072758 rows
> (the file was created from a bmp-picture by the routine read_bmp).
>
> My code is as follows:
>
> file='E:\Dissertation\mz_cam\spectral_calib\dat-files
> \070807\run24\070807_24_0013.dat'
>
> n_pixel= 2072758
> n_channels=3
>
> dummy_ein=fltarr(n_channels)
> dummy = ''
>
> r=fltarr(n_pixel)
> g=fltarr(n_pixel)
> nir=fltarr(n_pixel)
>
> close, 1
> openr,1, file
>
> for i=0, n_pixel-1 do begin
> readf, 1, dummy_ein
> g(i)=dummy_ein(0)
> r(i)=dummy_ein(1)
> nir(i)=dummy_ein(2)
> endfor
>
> end
>
> Could the problem be related to the array length? I mean that there
> are too many values for an array? I checked the number of values
> several times, so i am quite sure that the number for n_pixel is
> correct.

To keep the loop, you definitely need the "L", that should fix the
"loop expression too large for loop variable type." error.

You didn't mention what the original problem was though. You did
mention later that there was an "end of file error." So I would make
sure there really are n_pixel number of rows in the data file. (Use
"nLines = file_lines(file)" to find out.)

By the way, you can do this without a loop:

file = 'E:\Dissertation\mz_cam\spectral_calib\dat-files
\070807\run24\070807_24_0013.dat'

n_pixel = 2072758
n_channels =3

data = fltarr(n_channels, n_pixel)

openr, lun, file, /get_lun
readf, lun, data
free_lun, lun

; if you need the data in separate arrays
g = data[0, *]
r = data[1, *]
nir = data[2, *]

Mike
--
www.michaelgalloy.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to study IDL?
Next Topic: error message:unable to allocate memory

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

Current Time: Fri Oct 10 23:01:58 PDT 2025

Total time taken to generate the page: 0.72247 seconds