Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: HoldFirst question
  • Next by Date: Permutations
  • Previous by thread: Re: Re: Count Function
  • Next by thread: Re: Count Function