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