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

Home » Public Forums » archive » Re: FOR LOOP 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: FOR LOOP problem [message #30971] Sun, 02 June 2002 23:54 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Doug Rowland wrote:
>
> What happens if the image you are reading in is only 400x400 bytes (as seems
> to be implied by the filename)?
> Does readu then redefine image to be a 400x400 array or does it just leave
> the rest of the 462x350 array blank?

Dear Doug,

the rest 1700 bytes will be 0b and the size is (462, 350).
This gaves no new information.

It's not easy to examine the right size of a binary file.
First step could be to examine by fstat the byte size.
Then the data could be read as byte vector.

If you have an idea how it is organized you can use a reform
to put it in the correct size.

Reimar







>
> How about trying this:
>
> image = bytarr(462, 350)
> image_mod = bytarr(462, 350)
> openr, 1, FILEPATH(SUB=['examples','data'], '400_400_gb')
> readu, 1, image
> print,size(image)
> close,1
> end
>
> Doug Rowland
> rowland@fields.space.umn.edu
>
> On 05/31/02 4:27 PM, in article MPG.176198a6982878fc989905@news.frii.com,
> "David Fanning" <david@dfanning.com> wrote:
>
>> Shravan Kumar Durvasula (skd6@ra.msstate.edu) writes:
>>
>>> I am very much new to IDL. Could anyone please tell me what the problem is
>>> with
>>> this .pro file?
>>>
>>> ************************************************************ **********
>>> image = bytarr(462, 350)
>>> image_mod = bytarr(462, 350)
>>> openr, 1, FILEPATH(SUB=['examples','data'], '400_400_gb')
>>> readu, 1, image
>>> FOR i = 0, 461 DO BEGIN
>>> FOR j = 0, 349 DO image_mod[i,j] = image[i,j]
>>> ENDFOR
>>> close, 1
>>> ************************************************************ *********
>>>
>>> It gives me the following error message :
>>>
>>> ************************************************************ *********
>>> % Attempt to subscript IMAGE with I is out of range.
>>> % Execution halted at: $MAIN$
>>> ENDFOR
>>> ^
>>> % Syntax error.
>>> At: D:\webpages\IONJava\examples\ndvi_pro.pro, Line 7
>>> ************************************************************ *********
>>
>> I suspect the problem lies in how you are trying to
>> run this program. I recommend you put another END at the
>> end of the program file (after the CLOSE statement),
>> then run it like this from the IDL command line:
>>
>> IDL> .Run ndvi_pro
>>
>> Does that work better? This will compile the code before
>> it tries to run it. I think that will work better for you.
>>
>> I should point out that you can more easily do what you
>> want to do (and a hell of lot faster!) by simply writing this:
>>
>> image_mod = image
>>
>> Cheers,
>>
>> David

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Embedding applications into widgets.
Next Topic: Re: Plot resize

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

Current Time: Thu Oct 09 19:58:09 PDT 2025

Total time taken to generate the page: 0.71772 seconds