Re: Count Function
- To: mathgroup at smc.vnet.net
- Subject: [mg65536] Re: Count Function
- From: Jon Harrop <usenet at jdh30.plus.com>
- Date: Thu, 6 Apr 2006 06:53:15 -0400 (EDT)
- References: <e1091t$ljd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Gregory Lypny wrote: > The syntax will be the death of me. > > Count[X[[All,14]], -9.] will tally how many elements in column 14 of > matrix X are equal to -9, but I can't for the life of me figure out > how to get how many are greater than -9. Any hint would be most > appreciated. Use a guard function that matches only suitable elements: In[1] := Count[{1,2,3,4,5,6,7,8,9}, n_?(#>5&)] Out[1] = 4 -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html