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

Home » Public Forums » archive » Re: Easy question?
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: Easy question? [message #16323 is a reply to message #16318] Wed, 14 July 1999 00:00 Go to previous message
morisset is currently offline  morisset
Messages: 17
Registered: October 1997
Junior Member
Hello,

To get the vector of the mean over 2 dimensions, use total, like:

tab = findgen(3,3,3)
print,total(total(tab,1),1)

Play with the indices to mean over the dimension you want
(don't forget to divide by the product of the dimensions ;-).
Perhaps the order influences the speed if your tab doesn't have
the same dimensions?

To transform the 1D into 3D, first go to 2D, using:
tab2 = total(total(tab,1),1) # replicate(1,3)
tab2 = replicate(1,3) # total(total(tab,1),1)
or:
tab2 = replicate(1,3) ## total(total(tab,1),1)
tab2 = total(total(tab,1),1) ## replicate(1,3)
I don't know which of both is the quickest.

From 2D to 3D, I don't know without loop:

tab3 = fltarr(3,3,3,/nozero)
for i = 0,2 do tab3[*,*,i] = tab2

It's important to have the *'s as the first indices.
Hope it's help.

Christophe.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL_MakeStruct()
Next Topic: Julian Date Question

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

Current Time: Wed Oct 08 19:21:21 PDT 2025

Total time taken to generate the page: 0.00447 seconds