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

Home » Public Forums » archive » Re: uniq slow for loop
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: uniq slow for loop [message #67269 is a reply to message #67263] Thu, 16 July 2009 18:40 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Jul 16, 5:52 pm, newerjazz <shang...@gmail.com> wrote:
> Hi All,
>
> I have an array of [9,1,000,000]. In one of the columns are sorted
> numbers (eg. 0,1,1,2,3,3,3,3,3,4,4,5,5,5,6,7,7,7,etc). I want to pick
> out all the rows where column 9 is equal to some number and average
> all the quantities in those rows.
>
> Right now I use a for loop and the where function to pick out these
> rows. This is of course very slow. Anyway to increase the speed of
> this would be greatly appreciated. Thank you very much!
>
> Cheers,
> newerjazz
>
> nmax = max(data(8,*))
> FOR j=0, nmax DO BEGIN
> w=where(data(8,*) eq j, nw)
> blah=mean(data(*,w))
> etc,etc
> ENDFOR

Hi,

I am pretty sure that you want a variant of histogram. I think you
might be able to harness something from the following discussion.

http://tinyurl.com/nggcx6

Cheers,
Ben
[Message index]
 
Read Message
Read Message
Previous Topic: projections in idl
Next Topic: shapeinfo

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

Current Time: Fri Oct 10 12:33:14 PDT 2025

Total time taken to generate the page: 1.36074 seconds