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

Home » Public Forums » archive » For loop - Question
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 - Question [message #89991 is a reply to message #89989] Tue, 13 January 2015 06:46 Go to previous messageGo to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Tuesday, 13 January 2015 15:02:48 UTC+1, g.na...@gmail.com wrote:
> Hi
>
> I create a for loop to store my Data in a 3D array [100,200,200]. Then I used my data array to calculate another matrix B as shown below:
>
> for i=0, 99 do begin
> ArrayData = C:\Users\..
> endfor

I assume you mean something like this:

ArrayData = fltarr(100,200,200)
for i=0,99 do ArrayData[i,*,*] = my_get_data_from_file_function(file[i])

assuming that all the files contain data of the same size (200 x 200).

> B = total(ArrayData[0:4,*,*],1)/5.

This is the average of the first 5 images. Is this what you want?

> A question that I have is once I used the ArrayData outside the for loop does it contains all the elements of the array or just those on the place [100,120,120]?

I'm not really sure what you are asking about? ArrayData contains the elements you read into it in your loop. In the pseudocode you posted, it looks like you overwrite the array on each iteration in the loop. This is likely not what you want.

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL inverse matrix problem
Next Topic: Wavelet transform in IDL?

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

Current Time: Wed Oct 08 13:51:20 PDT 2025

Total time taken to generate the page: 0.00458 seconds