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

Home » Public Forums » archive » Re: Data elimination from array
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: Data elimination from array [message #51794] Fri, 08 December 2006 10:53 Go to next message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
Pffff, I should first think before posting...

Sorry, but isn't mgalloy's solution only for nlen=1, like in the small
example you gave?

I'm going to shut up now ;-)

On Fri, 08 Dec 2006 19:45:45 +0100, Wox <nomail@hotmail.com> wrote:

> Too slow again :-).
> Ok, forget about it, mgalloy's solution is much better :-).
>
> On Fri, 08 Dec 2006 19:36:37 +0100, Wox <nomail@hotmail.com> wrote:
>
>> Maybe this?
Re: Data elimination from array [message #51795 is a reply to message #51794] Fri, 08 December 2006 10:45 Go to previous messageGo to next message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
Too slow again :-).
Ok, forget about it, mgalloy's solution is much better :-).

On Fri, 08 Dec 2006 19:36:37 +0100, Wox <nomail@hotmail.com> wrote:

> Maybe this?
Re: Data elimination from array [message #51796 is a reply to message #51795] Fri, 08 December 2006 10:40 Go to previous messageGo to next message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Fri, 08 Dec 2006 19:36:37 +0100, Wox <nomail@hotmail.com> wrote:

> nlen=1

So this is 1792 in your case. You may also want to check whether the
array can be split up in 4n times 1792.
Re: Data elimination from array [message #51797 is a reply to message #51796] Fri, 08 December 2006 10:36 Go to previous messageGo to next message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
Maybe this?



array=[0,12,14,16,22,43,12,35,67,88,12,11,5,6,1,3]
narray=n_elements(array)
nlen=1
npiece=4
nblock0=nlen*npiece
nblock=narray/nblock0

array=reform(array,nlen,narray/nlen)
off0=indgen(npiece,nblock)

for i=0,npiece-1 do $
print,reform(array[*,off0[i,*]],narray/npiece)


The last loop is just for showing the 4 array, you probably want to
store them:

array0=reform(array[*,off0[0,*]],narray/npiece)
...



On 8 Dec 2006 09:07:44 -0800, "StevenM" <s.maclellan@strath.ac.uk>
wrote:

> Firstly, thanks to those of you who have replied to my posts, the
> replies have been very helpful and I really appreciate the time that
> has been taken on them.
>
> I am trying to re-organise an array of numbers into 4 new arrays. The
> array has 21446656 data points, and I would like to split it up into
> four arrays of 5361664 data points. I would like the first 1792 data
> points in the first new array, the second 1792 data points in the
> second new array and so on. I would then like for the 5th set of 1792
> data points (ie starting at data point 8959) to be put in the first new
> array and so on.
>
> To make this a bit clearer here is an example
> array{0,12,14,16,22,43,12,35,67,88,12,11}
>
> would become
>
> array1{0,22,67}
> array2{12,43,88}
> array3{14,12,12}
> array4{16,35,11}
>
> thanks in advance
>
> Steven
Re: Data elimination from array [message #51798 is a reply to message #51797] Fri, 08 December 2006 10:04 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
StevenM wrote:
> Firstly, thanks to those of you who have replied to my posts, the
> replies have been very helpful and I really appreciate the time that
> has been taken on them.
>
> I am trying to re-organise an array of numbers into 4 new arrays. The
> array has 21446656 data points, and I would like to split it up into
> four arrays of 5361664 data points. I would like the first 1792 data
> points in the first new array, the second 1792 data points in the
> second new array and so on. I would then like for the 5th set of 1792
> data points (ie starting at data point 8959) to be put in the first new
> array and so on.
>
> To make this a bit clearer here is an example
> array{0,12,14,16,22,43,12,35,67,88,12,11}
>
> would become
>
> array1{0,22,67}
> array2{12,43,88}
> array3{14,12,12}
> array4{16,35,11}
>

How about this?

array = randomu(seed, 64)
array1 = array[0:*:4]
array2 = array[1:*:4]
array3 = array[2:*:4]
array4 = array[3:*:4]

Mike
--
www.michaelgalloy.com
Re: Data elimination from array [message #51941 is a reply to message #51795] Fri, 08 December 2006 12:45 Go to previous message
Braedley is currently offline  Braedley
Messages: 57
Registered: September 2006
Member
Except that it doesn't work. No, the proper way of doing this is
gratuitous use of array juggling.

n=block_size
m=number_of_blocks_per_separate_array
array=randomu(seed, n*m*4)
array=reform(temporary(array), n, 4, m)
array1=reform(array[*, 0, *], n*m)
array2=reform(array[*, 1, *], n*m)
array3=reform(array[*, 2, *], n*m)
array4=reform(array[*, 3, *], n*m)

David or JD, feel free to suggest improvements on this (like further
juggling to help save time).

Cheers
Braedley

Wox wrote:
> Too slow again :-).
> Ok, forget about it, mgalloy's solution is much better :-).
>
> On Fri, 08 Dec 2006 19:36:37 +0100, Wox <nomail@hotmail.com> wrote:
>
>> Maybe this?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Average over odd/even lines
Next Topic: IDLWAVE (Mac) launching IDL as PPC rather than Intel

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

Current Time: Wed Oct 08 18:10:18 PDT 2025

Total time taken to generate the page: 0.00798 seconds