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

Home » Public Forums » archive » Re: correlation and NaN
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
Re: correlation and NaN [message #55852] Wed, 19 September 2007 01:53
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On Sep 19, 7:08 am, WRC2...@gmail.com wrote:
> Dear,
>
> I would like to caclulate correlation factors from arrays which also
> contains NaN values. Now, i checked some newsgroups and got answers
> like this:
>
> indices =[where( finite(Var1) eq 1),where( finite(Var2) eq 1)]
> common_indices = indices(UNIQ(indices, sort(indices)))
> Result = CORRELATE( Var1(common_indices), Var2(common_indices))
>
> or with the another command (get_intersection?? - sorry, forgot the
> right name, and can find it back anymore...)
>
> The first doesn't seems to work in my case (r² = NaN), and the second
> is not recognized in my IDL 5.6 version.
> For the first method, maybe it is because one array doesn't contain a
> NaN value???

No, finite() eq 1 filters for values that are non NaN, i.e. it
captures all normal numbers.
Does this work:
common_indices = where(finite(Var1) and finite(Var2), cnt)
if cnt gt 0 then $
Rsqr = CORRELATE( Var1[common_indices], Var2[common_indices])

Maarten
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: correlation and NaN
Next Topic: Re: Minimum between two arrays; no, not just Min(A-B)

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

Current Time: Wed Oct 08 15:11:39 PDT 2025

Total time taken to generate the page: 0.00566 seconds