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

Home » Public Forums » archive » Re: Question about the TOTAL function.
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: Question about the TOTAL function. [message #43540 is a reply to message #43539] Fri, 15 April 2005 09:08 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Nuno Oliveira wrote:
> I have a question that somebody that works with IDL many had faced before.
> Imagine I have a matrix(X,Y), no matter the type of variable, and if want na
> array with the projection along de x axis, something like
>
>
>
> for i = 0, n-1 do $
>
> SUMX = TOTAL(i, *)

; I presume you mean
sumx[i] = TOTAL(matrix[i,*])

> How can I do it without the FOR cicle.

sumx = TOTAL(matrix, 2)

; Similarly, if you want to calculate
sumy[j] = TOTAL(matrix[*,j])

; you can just use:
sumy = TOTAL(matrix,1)
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: tvimage, imcontour and ps dimensions
Next Topic: how to do a loop in idl using multi-commmand?

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

Current Time: Fri Oct 10 06:24:18 PDT 2025

Total time taken to generate the page: 0.64042 seconds