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

Home » Public Forums » archive » Multi-dimensions without for loop ?
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
Multi-dimensions without for loop ? [message #38766] Thu, 25 March 2004 02:47
Emmanuel Christophe is currently offline  Emmanuel Christophe
Messages: 11
Registered: March 2004
Junior Member
Hi,

I'm trying to optimize some IDL code, removing for loops.

I'm using the mean function to get the average of each line (this is for
the example, could be another function). From a 2 dimensional array, I
want to remove the mean of each column.

Here is a sample using a loop:
--------------------------------
for j=0,size-1 do begin
vect=data[j,*]
datac[j,*]=vect-mean(vect)
endfor
--------------------------------

How to do it in one instruction: if i'm using something like
'mean(data)', i'll get the average for the whole array, and not line by
line.

the instruction 'total' give me something similar to what I want:
'total(data,1)' will make the sum in only one direction.

How to get that with ordinary function ? and is it possible ? I'm
thinking of something like 'data[0:size-1,*]'...

Thanks,

Emmanuel
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Aster L1B data in HDF format
Next Topic: Which widget does ENVI use, when ENVI_SELECT is called? (empty body)

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

Current Time: Wed Oct 08 15:58:55 PDT 2025

Total time taken to generate the page: 0.00281 seconds