MathGroup Archive 2005

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

Search the Archive

Re: Help! Delete Casses based on column

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58306] Re: Help! Delete Casses based on column
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sun, 26 Jun 2005 23:13:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 6/26/05 at 1:33 AM, tornado78 at hotmail.com (tornado78) wrote:

>I need to take a large numeric matrix and remove all the rows that
>have a value less than X in column N

First, using Table to generate a random matrix

In[1]:=
data = Table[Random[], {i, 5}, {j, 5}]
Out[1]=
{{0.7782881593866494, 
   0.6753591418097964, 
   0.9449449797796714, 
   0.37735570973406635, 
   0.6250430512630213}, 
  {0.7774244995727889, 
   0.6447847938619459, 
   0.8176979735737523, 
   0.8623853364999774, 
   0.0803196694199144}, 
  {0.8740035700727821, 
   0.402979840643203, 
   0.46652340639843337, 
   0.8909105854301345, 
   0.3997272322978968}, 
  {0.6150459139286458, 
   0.5304020309232242, 
   0.12667830628081253, 
   0.6939192674223005, 
   0.8949467718141887}, 
  {0.44714646243832995, 
   0.17821492267582964, 
   0.5725611138098228, 
   0.3112823655223339, 
   0.6688583030516806}}

Then Pick can be used to do what you want. That is dropping all of the rows which have a value of less than .5 in column 4 could be done as:

In[2]:=
Pick[data, (#1 >= 0.5 & ) /@  data[[All,4]]]
Out[2]=
{{0.7774244995727889, 
   0.6447847938619459, 
   0.8176979735737523, 
   0.8623853364999774, 
   0.0803196694199144}, 
  {0.8740035700727821, 
   0.402979840643203, 
   0.46652340639843337, 
   0.8909105854301345, 
   0.3997272322978968}, 
  {0.6150459139286458, 
   0.5304020309232242, 
   0.12667830628081253, 
   0.6939192674223005, 
   0.8949467718141887}}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Help! Delete Casses based on column
  • Next by Date: splinefit
  • Previous by thread: Re: Help! Delete Casses based on column
  • Next by thread: Re: Help! Delete Casses based on column