X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 18 Jul 2005 02:24 PM by  anon
where() function not working properly
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
18 Jul 2005 02:24 PM
    Hello All: I have a N by 2 matrix as follows: FABSCoordinates[*,0] = [n1,n2,n3,......ni] FABSCoordinates[*,1]=[m1,m2,m3......mj] It contains the N and M coordinate lists for a certain group of objects within an image. What I need to do is filter these coordinates for some given boundary points (in N and M). This is carried out as follows: ;--for N-boundaries filterMaxN = where(FABSCoordinates[*,0] LE maxBoundPtN) filterMinN = where(FABSCoordinates[filterMaxN,0] GE minBoundPtN) ;--now filter the M-coordinates for the bounds that were passed from the N filtering filterMaxM = where(FABSCoordinates[filterMinN,1] LE maxBoundPtM) filterMinM = where(FABSCoordinates[filterMaxM,1] GE minBoundPtM) Ncoordinates = FABSCoordinates[filterMinM,0] Mcoordinates = FABSCoordinates[filterMinM,1] ;--re-initialize a variable to store the N and M coordinates for the region of interest FABSCoords = lindgen(n_elements(Ncoordinates),2) FABSCoords[*,0] = Ncoordinates FABSCoords[*,1] = Mcoordinates The problem with the above code is that it does not filter anything and instead returns the original coordinates for N and M. Any Ideas?

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Jul 2005 02:24 PM
    Your logic looks ok. Perhaps it is simply that all of your data falls within your boundary conditions. I suggest making use of the count positional parameter for WHERE and looking to see if your boundary conditions are actually cutting anything out. By the way, you should always check whether or not WHERE find a match before using the result. Just when you start thinking "This will always give a valid result", it will not be so.
    You are not authorized to post a reply.