MathGroup Archive 2005

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

Search the Archive

Count using pattern on two different matrices

I have two matrices with an equal number of rows, but not necessarily 
columns, for example:

L1= {{True,False},{False, True},{False, False}, etc.....} ;
L2= {{True,False,False},{True, True,True},{False, True,False}, etc.....} ;

I would like to compute a count of the number of rows in which one of 
the columns of L1 meets some criterion, and one of the columns of L2 
meets some criterion, i.e.  If L1[[row,2 ]]==False  and 
L2[[row,3]]==True  then this row contributes 1 to the count.

I suspect that there is an elegant way to do this, perhaps using Count[] 
and MapThread, but I can't figure it out other than resorting to a 
rather clumsy For or Do loop that would check line by line and maintain 
a counter.

Any help would be appreciated,

  • Prev by Date: Re: Representation and Simulation of Dynamic Systems
  • Next by Date: Re: ChineseRemainder
  • Previous by thread: Re: DSolve and K$31, i am puzzled
  • Next by thread: Re: Count using pattern on two different matrices