Re: where function not finding value [message #90565 is a reply to message #90562] |
Tue, 10 March 2015 11:42   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jahvasc writes:
>
> However, when I use the where function, I get some "holes". This is the bit of the code I'm using:
>
> mmod=[findgen(10)*0.01 + 0.01,findgen(3)*0.1 + 0.2]
> massi=0.
> for j=0,12 do begin
> a=where(mass gt massi and mass le mmod(j),count)
> print,massi,mmod(j),count
> massi=mmod(j)
> endfor
>
> In this case I get the following numbers:
>
> 0.00000 0.0100000 79
> 0.0100000 0.0200000 57
> 0.0200000 0.0300000 48
> 0.0300000 0.0400000 44
> 0.0400000 0.0500000 0
> 0.0500000 0.0600000 43
> 0.0600000 0.0700000 73
> 0.0700000 0.0800000 43
> 0.0800000 0.0900000 0
> 0.0900000 0.100000 31
> 0.100000 0.200000 59
> 0.200000 0.300000 14
> 0.300000 0.400000 9
>
> When I manually try, for example,
>
> a=where(mass gt 0.04 and mass le 0.05,count)
> print,count
>
> I get count=43. What's is going on?
Given the evidence, I would say you are making incorrect assumptions
about your data.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|