X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 23 Sep 2013 03:24 AM by  anon
where Function
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
23 Sep 2013 03:24 AM
    Dear all, I am quite new in IDL programing.. I want to make a mask in IDL. I tried to use where function. I have a file ranged from 0 - 1. The aim is giving 1 value to the all pixels range from 0.60 - 0.90 and 0 to pixels with values less than 0.6 and greater than 0.90. I did it i this way but in some part it does not work. would you please help me.. A[where(A gt 0.60 and A le 0.90)]=1.0 A[where(A le 0.60 and A g 0.90)]=0.0 the first line works very well but the second part does not work completely.

    Deleted User



    New Member


    Posts:
    New Member


    --
    23 Sep 2013 06:52 AM
    It will be hard to find a value is both less than 0.6 *and* greater than 0.9 at the same time. Perhaps you mean OR, rather than AND. Also, you are going to get into trouble eventually when your Boolean expression doesn't produce any results. Try a syntax like this. indices = Where(a LT 0.6 OR a GT 0.9, count) IF count GT 0 THEN a[indices] = 0.0
    You are not authorized to post a reply.