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

Home » Public Forums » archive » Re: Unpacking algorithm
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: Unpacking algorithm [message #39317] Mon, 17 May 2004 06:41 Go to previous message
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
Tmorri:

If I have understood your problem, then the following might do the job
(given your vector v0, of which you want to get every 4th element into
v1 and the others into v2).

i0 = INDGEN(N_ELEMENTS(v0))
i1 = WHERE((i0 MOD 4) EQ 0, COMPLEMENT=i2)
v1 = v0[i1]
v2 = v0[i2]

Hope this helps,
Timm

PS. I'm sure there's a better way than using WHERE, but I don't like to
think.

On 15.05.04 at 19:00 -0400, Tmorri wrote:

> one second thought,
>
> Does any one have an algorithm to unpack this vector
>
>
> v0=[0 x1 x2 x3 0 x4 x5 x1 0 x2 x3 x4 0 x5 x1 x2 0 x3 x4 x5]
>
> in the following way:
>
> v1=[0 0 0 0 0]
>
> v2=[x1 x2 x3 x4 x5 x1 x2 x3 x4 x5 x1 x2 x3 x4 x5]
>
> x1,x2,x3,x4,x5 are variables that can take any value, even zero, (0).
>
> I just want to get rid othe zeroes (every fourth element)shown in vector
> v0
>
>
> Thanks,
>
> Tmorri
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: allocate heap? yes or no?
Next Topic: Re: Unpacking algoritmn

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

Current Time: Fri Oct 10 01:41:49 PDT 2025

Total time taken to generate the page: 0.72324 seconds