MathGroup Archive 2006

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

Search the Archive

Re: Selecting Many Things Rather Than Selecting One Thing From Many


On 5/3/06 at 2:44 AM, gregory.lypny at videotron.ca (Gregory Lypny)
wrote:

>I've discovered another use or need for the Select function, which I
>suspect requires mapping of some sort.

>In my previous posts, members of this MathGroup kindly showed me how
>to apply Select to many columns of a matrix at once.  For example,

>(Select[#1, #1 > K & ] & ) /@ Transpose[theMatrix]

>will pull out all values greater than K, where K is a number such as
>100.

>But suppose now that K is a list of numbers, such as K={34, 876,
>199}, and I simply want to extract or identify all of the rows in
>the first column of theMatrix equal to any one of those numbers. 
>How would I do that?  I started with

>Select[theMatrix, #[[1]]==any element of list K]

Use

Select[theMatrix, MemberQ[listK, #[[1]]]&]
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: "In progress" saving of data collected using Reap/Sow
  • Next by Date: Re: Selecting Many Things Rather Than Selecting One Thing From Many
  • Previous by thread: Re: Selecting Many Things Rather Than Selecting One Thing From Many
  • Next by thread: Re: Selecting Many Things Rather Than Selecting One Thing From Many