Re: How to "search" in a matrix?

*To*: mathgroup at smc.vnet.net*Subject*: [mg60914] Re: How to "search" in a matrix?*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Mon, 3 Oct 2005 04:06:13 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 10/2/05 at 1:54 AM, renan.birck at gmail.com (Renan) wrote: >I have this matrix: >matr = {{a, b, 1}, {c, d, 2}, {e, f, 3}} >I'm trying to do a "search" in a matrix. The "real" matrix will >contain strings. How to "search" for a given value in a matrix and >return all lines that have it? >'Select' seems to handle only lists - and this would require a >Flatten, probably making my code too complicated and maybe slow >(the real matrix will contain something like 100 elements - weather >data). Try Select[matr, MemberQ[#, d]&] or for a matrix of strings Select[matr, MemberQ[#,"d"]&] -- To reply via email subtract one hundred and four