Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: How to "search" in a matrix?

  • To: mathgroup at
  • Subject: [mg60904] Re: [mg60892] How to "search" in a matrix?
  • From: Bob Hanlon <hanlonr at>
  • Date: Mon, 3 Oct 2005 04:06:03 -0400 (EDT)
  • Reply-to: hanlonr at
  • Sender: owner-wri-mathgroup at


To select all rows containing c

Select[matr, !FreeQ[#,c]&]

{{c, d, 2}}

Bob Hanlon

> From: Renan <renan.birck at>
To: mathgroup at
> Date: 2005/10/02 Sun AM 01:54:43 EDT
> Subject: [mg60904] [mg60892] How to "search" in a matrix?
> 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 
> '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).
> Thanks.

  • Prev by Date: Re: How to "search" in a matrix?
  • Next by Date: Re: Finding length in recursive definition?
  • Previous by thread: Re: How to "search" in a matrix?
  • Next by thread: Re: How to "search" in a matrix?