X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 23 Jun 2009 08:49 AM by  anon
where conditions
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
23 Jun 2009 08:49 AM
    hi everybody,   i've got no idea to solve my problem so you are my last hope! the solution may be quite simple, but not for me. so...this is the task: an array with x columns and y rows with a variety of values. i just want to replace the variety of values by three simple values. for this purpose, i defined three conditions. here an example: value = fltarr(cols, rows) seg = fltarr(cols,rows) mean = 3.4 sd = 1.4 K=0.82 a = where(value gt -5) b=where((value lt -5) and (value gt -7.5) and (value-mean/sd gt K)) c=where(value lt -75) seg[a]=1 seg[b]=0.5 seg[c]=0 so....the compilation is ok, but the run of the script results in an error massage: attempt to subscript seg with b isout of range...as i take it, there must be an error in b=where(...). can anybody tell me, how to use three conditions in where(...).   thanks in advance, cwesche    

    Deleted User



    New Member


    Posts:
    New Member


    --
    23 Jun 2009 03:25 PM
    use this: b=where((value lt -5) and (value gt -7.5) and (value-mean/sd gt K), count) if count gt 0 then seg[b]=0.5 in case your where() call isn't finding anything.  That'll at least avoid the error and you can print, count to see how many values the where() is finding.

    Deleted User



    New Member


    Posts:
    New Member


    --
    24 Jun 2009 01:22 AM
    hi jeffrey, thanks a lot for your answer...it seems to work...the first tests show the anticipated result! cheers
    You are not authorized to post a reply.