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

Home » Public Forums » archive » avoiding for loop when calculating median
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
avoiding for loop when calculating median [message #10967] Thu, 29 January 1998 00:00
George McCabe is currently offline  George McCabe
Messages: 23
Registered: June 1997
Junior Member
Hello,

calculating the median of each i set of values M(i,*), I would like to
'vectorize' the operation to avoid a FOR loop like the following -

for cnt=0,idim-1 do begin
calcmedian(cnt)=median(mat(cnt,*))
end

but, you can't do -

cnt=indgen(idim)
calcmedian(cnt)=median(M(cnt,*))

and get the desired result, where each element of calcmedian() will be
assigned the same value.

can it be done wothout a FOR loop?

Thank you, George

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV VVVVVVVVV
George McCabe (HSTX) NASA / GSFC
Tel: (301)286-8283, Fax: (301)286-0212 Code 693, B2 R151
E-mail: george.mccabe@gsfc.nasa.gov Greenbelt, MD 20912
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: how to grab !X.TICKS from previously drawn plot?
Next Topic: how to grab !X.TICKS from previously drawn plot?

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

Current Time: Sun Oct 12 04:20:44 PDT 2025

Total time taken to generate the page: 0.32290 seconds