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

Home » Public Forums » archive » Re: More For Loops
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: More For Loops [message #19676] Thu, 13 April 2000 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Craig Markwardt <craigmnet@cow.physics.wisc.edu> writes:

> majewski@cygnus.uwa.edu.au_stralia writes:
...
>> for i = 0, (DATA_size[0]/2)-1 do begin
>> for j = 0, DATA_size[1]-1 do begin
>> Data_sets_ev[i,j] = my_data[(2*i),(2*j)]
>> Data_sets_od[i,j] = my_data[(2*i),(2*j+1)]
>> endfor
>> endfor
...
>
> Keep in mind that a (2M) x N array can be thought of as a 2 x M x N
> array -- or an M x N array of pairs. IDL can reform the first kind of
> array into the second, and then it's a simple matter of extracting
> what you want. The "_ev" is the first of each pair, the "_od" is the
> second.
>
> my_data = reform(my_data, 2, x_data/2, y_data, /overwrite)
>
> data_sets_ev = my_data[0,*,*]
> data_sets_od = my_data[1,*,*]

Ah, replying to myself. I must be getting older.

I see now that I didn't understand the layout of your original array.
Your my_data is really a (2*M*2) x N array. That is, the even and odd
rows are interleaved. This is still no problem. The revised form is:

my_data = reform(my_data, 2, x_data/4, 2, y_data, /overwrite)
; pair row pair of rows array

data_sets_ev = my_data[0,*,0,*]
data_sets_od = my_data[0,*,1,*]

In this case it appears that you are only interested in the first of
each pair of elements, hence the [0,...].

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Breakdown of IDL 5.3 license manager after Update Inux
Next Topic: Re: Color Questions

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

Current Time: Thu Oct 09 22:49:26 PDT 2025

Total time taken to generate the page: 0.74057 seconds