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

Home » Public Forums » archive » Re: for loop isn't working
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: for loop isn't working [message #71743] Thu, 15 July 2010 14:04
Snow53 is currently offline  Snow53
Messages: 32
Registered: July 2010
Member
On Jul 15, 2:06 pm, Paul van Delst <paul.vande...@noaa.gov> wrote:
> Snow53 wrote:
>> Hi, you all are so wonderful to help me with my silly questions. Many
>> thanks!
>
>> I have this program that converts files to EASE grid within a folder
>> and outputs them as a different file. It works fine, but the problem I
>> have is that it doesn't loop through all the files in the folder. It
>> stops after the first. I can change the file output by changing i
>> (example: changing to i=2 gives me output for the second file in the
>> list resulting from the search function), but still I only get one
>> file output.
>
>> It must be something obvious, but I'm not seeing it.
>
>> Thanks again. :)
>
>> ; loops through and extracts pixel data based on the above-determined
>> pixel location.
>> for i=1, num_file-1 do begin
>
> you have a nested loop with the same index, and
>
>> for i=0l, 209087-1 do begin
>
>>   grid[globland_cols[i]-1,globland_rows[i]-1] = vector[i]
>> endfor
>
> you return before the end of the outer loop.
>
>> return
>
>> endfor
>
>> end
>
> cheers,
>
> paulv- Hide quoted text -
>
> - Show quoted text -

Wow! That was an easy fix. I changed the i in the nested loop to f,
and moved the return until after the second endfor. Thanks for the
extra set of eyes.
Re: for loop isn't working [message #71744 is a reply to message #71743] Thu, 15 July 2010 13:06 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Snow53 wrote:
> Hi, you all are so wonderful to help me with my silly questions. Many
> thanks!
>
> I have this program that converts files to EASE grid within a folder
> and outputs them as a different file. It works fine, but the problem I
> have is that it doesn't loop through all the files in the folder. It
> stops after the first. I can change the file output by changing i
> (example: changing to i=2 gives me output for the second file in the
> list resulting from the search function), but still I only get one
> file output.
>
> It must be something obvious, but I'm not seeing it.
>
> Thanks again. :)
>

> ; loops through and extracts pixel data based on the above-determined
> pixel location.
> for i=1, num_file-1 do begin

you have a nested loop with the same index, and

> for i=0l, 209087-1 do begin
>
> grid[globland_cols[i]-1,globland_rows[i]-1] = vector[i]
> endfor

you return before the end of the outer loop.

> return
>
>
> endfor
>
> end

cheers,

paulv
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: for loop isn't working
Next Topic: GDL 0.9rc4+CVS packages for Ubuntu 9.10 and 10.04

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

Current Time: Wed Oct 08 15:15:50 PDT 2025

Total time taken to generate the page: 0.00571 seconds