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 #39324 is a reply to message #39322] Sun, 16 May 2004 08:19 Go to previous messageGo to previous message
Christopher Lee is currently offline  Christopher Lee
Messages: 4
Registered: February 2001
Junior Member
> v0=[0 x1 x2 x3 0 x4 x5 x1 0 x2 x3 x4 0 x5 x1 x2 0 x3 x4 x5]
>
> I just want to get rid othe zeroes (every fourth element)shown in vector
> v0


n=n_elements(v0)
s=4
index=(findgen(s,fix((n+3)/s)))[1:s-1,*]
index=reform(index, n_elements(index))
;index skips all of the mod 4 indices
new_v=v0[index]

;or even shorter, if n_elements(v0) mod s = 0

s=4
v0=reform((reform(v0,s,n_elements(v0)/s))[1:s-1,*],n_element s(v0)*(s-1)/s)

Chris.
[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 10:30:32 PDT 2025

Total time taken to generate the page: 0.88432 seconds