MathGroup Archive 2006

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

Search the Archive

Re: Count Function

  • To: mathgroup at
  • Subject: [mg65536] Re: Count Function
  • From: Jon Harrop <usenet at>
  • Date: Thu, 6 Apr 2006 06:53:15 -0400 (EDT)
  • References: <e1091t$ljd$>
  • Sender: owner-wri-mathgroup at

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.

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