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

Home » Public Forums » archive » Array is empty after for loop
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
Array is empty after for loop [message #91482] Mon, 20 July 2015 02:25 Go to next message
Dete van Eeden is currently offline  Dete van Eeden
Messages: 32
Registered: July 2015
Member
Hallo

I have an array profile=fltarr(500,6)

I read values into this array in a for loop

for k=0,5 do begin

for i=0,499 do begin

profile(i,k) = .....

endfor

endfor

while Im in the loop, there are values in the array profile but as soon as I exit the loop the whole array is empty?

How can this be?
Re: Array is empty after for loop [message #91490 is a reply to message #91482] Mon, 20 July 2015 11:40 Go to previous messageGo to next message
a146397258 is currently offline  a146397258
Messages: 7
Registered: July 2015
Junior Member
On Monday, July 20, 2015 at 3:25:38 AM UTC-6, Dete van Eeden wrote:
> Hallo
>
> I have an array profile=fltarr(500,6)
>
> I read values into this array in a for loop
>
> for k=0,5 do begin
>
> for i=0,499 do begin
>
> profile(i,k) = .....
>
> endfor
>
> endfor
>
> while Im in the loop, there are values in the array profile but as soon as I exit the loop the whole array is empty?
>
> How can this be?

It runs fine for me. So the error must be in the part of the loop that you omitted.
Re: Array is empty after for loop [message #91499 is a reply to message #91482] Tue, 21 July 2015 07:56 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Monday, July 20, 2015 at 4:25:38 AM UTC-5, Dete van Eeden wrote:
> Hallo
>
> I have an array profile=fltarr(500,6)
>
> I read values into this array in a for loop
>
> for k=0,5 do begin
> for i=0,499 do begin
> profile[i,k] = i*k ;square brackets for array indexing
> endfor
> endfor
>
> help, profile
>
> while Im in the loop, there are values in the array profile but as soon as I exit the loop the whole array is empty?
>

What do you mean the array is empty? Is it not defined? Full of zeros? Listlessly wandering through life?

I have modified your code slightly above. What is the result?
Re: Array is empty after for loop [message #91506 is a reply to message #91499] Wed, 22 July 2015 08:59 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 07/21/15 10:56, Phillip Bitzer wrote:
>
> What do you mean the array is empty? Is it not defined? Full of
> zeros? Listlessly wandering through life?

"Listlessly wandering through life?"

Ha ha ha!! (He says as he cleans up the coffee that came shooting out of
his nose!)

Gosh I needed that.

cheers,

paulv
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Averaging values in an array
Next Topic: Getting Transects in IDL

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

Current Time: Wed Oct 08 15:10:35 PDT 2025

Total time taken to generate the page: 0.00426 seconds