Re: Count using pattern on two different matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg57085] Re: [mg57079] Count using pattern on two different matrices
- From: DrBob <drbob at bigfoot.com>
- Date: Sun, 15 May 2005 03:03:38 -0400 (EDT)
- Organization: Deep Space Corps of Engineers
- References: <200505140858.EAA09500@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
Length@Cases[Transpose@{L1, L2}, {{_, False}, {_, _, True}}] Bobby On Sat, 14 May 2005 04:58:25 -0400 (EDT), Lee Newman <leenewm at umich.edu> wrote: > 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, > Lee > > > > -- DrBob at bigfoot.com
- References:
- Count using pattern on two different matrices
- From: Lee Newman <leenewm@umich.edu>
- Count using pattern on two different matrices