PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Dec 2002 08:57 PM by  Jan Kristian Jensen
Invalid numbers: Bug in where and finite
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Jan Kristian Jensen



New Member


Posts:
New Member


--
11 Dec 2002 08:57 PM
    I just discovered that the following line idx = WHERE(A[WHERE(FINITE(A) EQ 1)] GT 13.0) does NOT give the expected result: print, a[ idx ] looks something like: 11.3799 11.7700 NaN 12.1800 12.3900 NaN NaN The statement above (idx=where..) is by the way a _*direct*_ copy of an example in the online documentation for the 'where' function... (Hence the capital letters) An easy workaround is of course to remove all the Nan's: nan_idx = where( finite(a) eq 0 ) a[ nan_idx ] = -100 Then, using idx = where( a ge 13.0 ) I get the correct indices. Note that I use _*exactly*_ the same method as described in the documentation to solve a simple problem with invalid numbers within the dataset. And yet it gives med bogus results :( Regards, Jan

    Seungbum Kim



    New Member


    Posts:
    New Member


    --
    11 Dec 2002 08:57 PM
    idx1 = WHERE(FINITE(A) EQ 1) idx2 = WHERE(A(idx1) GT 13.0) PRINT, A(idx1(idx2)) See the pitfall?
    You are not authorized to post a reply.


    SIGN UP AND STAY INFORMED

    Sign up to receive the latest news, events, technologies, and special offers.

    SIGN ME UP