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

Home » Public Forums » archive » Re: help with chunk indexing
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: help with chunk indexing [message #54644 is a reply to message #54641] Mon, 02 July 2007 02:53 Go to previous messageGo to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Fri, 29 Jun 2007 19:51:14 -0000, "Matt B." <becker.mr@gmail.com>
wrote:

> But what is a fast way to do this
> n = [1,2,1,4] ==> inds = [0,0,1,0,0,1 ,2 ,3]

Maybe there is a more clever way, but this works:

in=[1,2,1,4]
h=histogram(total(in,/CUMULATIVE,/PRESERVE_TYPE)-1,/BINSIZE, MIN=0,REVERSE_INDICES=ri)
nh=n_elements(h)

i=ri[0:nh-1]-ri[0]
ind=shift(i,-1)-i
ind=[1,ind[0:nh-2]]
out=indgen(nh)-(where(ind))[i]

print,out ;[0,0,1,0,0,1 ,2 ,3]
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Get Latitude and Longitude from Tiff files
Next Topic: moxed format file i/o

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

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

Total time taken to generate the page: 0.88005 seconds