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 #55340] Mon, 20 August 2007 01:31 Go to previous message
britta.mey is currently offline  britta.mey
Messages: 14
Registered: August 2007
Junior Member
On 20 Aug., 09:23, britta....@gmail.com wrote:
> On 20 Aug., 02:41, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
>
>
>
>> 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
>
> Hello,
>
> oh yes, i forgot in the original post to mention my problem. Sorry.
> I'll try to fix my problem with your suggestions.
>
> Thank you,
>
> Britta


Hello again,

i tried your suggestions, but i still get the "end of file-error".
Even if i tried the suggested code without the loop. Do you have any
idea what could be further wrong? I checked the number of lines with
"nLines = file_lines(file)". The number is correct :-( .

Yours,
Britta
[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 09:27:14 PDT 2025

Total time taken to generate the page: 0.71852 seconds