Re: How to "search" in a matrix?
- To: mathgroup at smc.vnet.net
- Subject: [mg60930] Re: How to "search" in a matrix?
- From: albert <awnl at arcor.de>
- Date: Tue, 4 Oct 2005 01:24:57 -0400 (EDT)
- References: <dhnt71$1hu$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, > 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? I think Cases is even easier to use for this case. If you are searching in Matrices only, this is probably the thing to use when looking for lines containing d: Cases[matr,{___,d,___}] It should work just as well for strings instead of symbols. For more complicated structures, there are additional Arguments for Select and Cases which control the level where to look for matches... albert