Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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: Help! Delete Casses based on column

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58308] Re: Help! Delete Casses based on column
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sun, 26 Jun 2005 23:13:10 -0400 (EDT)
  • References: <d9lfee$13q$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

tornado78 schrieb:
> Any help would be apreciated 
> 
> I need to take a large numeric matrix and remove all the rows that have a value less than X in column N
> 
> Since its a large matrix im looking for an efficient algorithm.
> 
> thanks
> 
Keep the rows with the Nth element >= X:

In[1]:= selRows[mat_, colN_, x_] := Select[mat, #[[colN]] >= x & ];
In[2]:= ma = Table[2*Random[] - 1, {3}, {3}]
Out[2]=
{{0.3171628546585681, 0.23619352873418786, -0.8095767944291659},
  {-0.6365968204956134, -0.1210099135908731, -0.5537127320449792},
  {0.8023605066982464, -0.5088705127064685, -0.6881540042883649}}
In[3]:= selRows[ma, 1, 0.2]
Out[3]=
{{0.3171628546585681, 0.23619352873418786, -0.8095767944291659},
  {0.8023605066982464, -0.5088705127064685, -0.6881540042883649}}

-- 
Peter Pein
Berlin


  • Prev by Date: Re: Mathematica Visualization site - update
  • Next by Date: Re: Help! Delete Casses based on column
  • Previous by thread: Re: Help! Delete Casses based on column
  • Next by thread: Re: Help! Delete Casses based on column