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

Home » Public Forums » archive » Re: Oooh...! It's harder than I thought!! To get average of each line using only meaningful data
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: Oooh...! It's harder than I thought!! To get average of each line using only meaningful data [message #54948 is a reply to message #54947] Tue, 24 July 2007 08:40 Go to previous messageGo to previous message
edward.s.meinel@aero. is currently offline  edward.s.meinel@aero.
Messages: 52
Registered: February 2005
Member
On Jul 24, 8:47 am, Conor <cmanc...@gmail.com> wrote:
>
> totals = total(data_arr,1)/total(data_arr<1,1)
>
> total(data_arr,1) returns a row vector where each element is the total
> of a single line of data. total(data_arr<1,1) does essentially the
> same thing, but first it imposes a ceiling on the array, so that no
> value is greater than 1. Then, when you total across a line, what you
> get is the total number of non-zero elements.

Very clever, Conor! It just needs one small change: You have assumed
that the total number of non-zero elements is, well, non-zero. If
there are no non-zero elements, it will choke, so just do,

totals = total(data_arr,1)/(total(data_arr<1,1) > 1)

I use the */(* > 1) trick quite frequently.

Ed
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL crashing on call of TV - solved
Next Topic: Re: recommendations for curve fitting

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

Current Time: Sat Oct 11 02:37:13 PDT 2025

Total time taken to generate the page: 0.79721 seconds