MathGroup Archive 2005

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

Search the Archive

Re: How to "search" in a matrix?

  • To: mathgroup at
  • Subject: [mg60930] Re: How to "search" in a matrix?
  • From: albert <awnl at>
  • Date: Tue, 4 Oct 2005 01:24:57 -0400 (EDT)
  • References: <dhnt71$1hu$>
  • Sender: owner-wri-mathgroup at


> 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:

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...


  • Prev by Date: partitioning a string
  • Next by Date: Partition(divid string to substring
  • Previous by thread: Re: How to "search" in a matrix?
  • Next by thread: Re:A programming puzzle