comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » help with - count in where() function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: help with - count in where() function [message #90869 is a reply to message #90868] Thu, 30 April 2015 10:58 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 04/30/15 13:32, g.nacarts@gmail.com wrote:
> Hi
>
> I wrote a simple example of my code to understand the behaviour of
count in the where() function but I still don't understand something.
>
> My example:
>
> array = [[-1,2,3,4,5],[6,-7,8,9,10]]
> mask =bytarr(5,5)
> for i=0L,4 do begin
> for j=0L, 4 do begin
> IF (TOTAL(ARRAY GT 5.)+ TOTAL(Array LT 0.)) EQ 0 THEN mask[i,j]=1
> endfor
> endfor
>
> ind = where(mask EQ 1,count)
> print, count
> IDL> 0
>
>
> print, total(array GT 5.)
>> IDL 4.00000
> print, total(array LT 0.)
>> IDL 2.00000
>
>
> I was expecting the answers in the two last prints. I don't
> understand
why when I print out the count it's zero. Can anyone help?
>
> Actually I was expecting to be 4 because there are 2 negatives and 4
greater than 5 so (2+4=6, thus 10-6=4).

Umm....but you're asking to set the mask element if 4+2 = 0.

Last time I checked, 4+2 never equals 0 (in this universe at least) so
no mask elements will ever be set to 1.

Maybe your TOTAL() commands require some additional info re the i or j
indices?

Or am I being brain dead here?

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Copying contents of a function graphics window
Next Topic: Mapping southern in Northern map

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:55:46 PDT 2025

Total time taken to generate the page: 0.00424 seconds