Selecting Rows Based on Column Values
- To: mathgroup at smc.vnet.net
- Subject: [mg101471] Selecting Rows Based on Column Values
- From: cynthia wu <wu.x.cynthia at gmail.com>
- Date: Wed, 8 Jul 2009 07:10:21 -0400 (EDT)
I've been trying to use the Select Command to select only the rows that have the a specific value in a specific column. I have, for example, the following matrix (4x3): tester={{1, 3, 1}, {3, 1, 0}, {4, 2, 1}, {5, 6, 2}} I want to select the rows that have values ==1 in the 3rd column. I've tried: select(tester, #[[All,3]]==1&), but I get an error saying that my request violates the matrix boundaries. The desired output should be: {{1,3,1}, {4,2,1}}. Any thoughts would be greatly appreciated. Thanks!
- Follow-Ups:
- Re: Selecting Rows Based on Column Values
- From: "Elton Kurt TeKolste" <tekolste@fastmail.us>
- Re: Selecting Rows Based on Column Values
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Selecting Rows Based on Column Values
- From: Syd Geraghty <sydgeraghty@me.com>
- Re: Selecting Rows Based on Column Values
- From: Adriano Pascoletti <adriano.pascoletti@dimi.uniud.it>
- Re: Selecting Rows Based on Column Values
- From: Thomas Dowling <thomasgdowling@gmail.com>
- Re: Selecting Rows Based on Column Values
- From: Tomas Garza <tgarza10@msn.com>
- Re: Selecting Rows Based on Column Values
- From: Yasvir Tesiram <tesiramy@omrf.org>
- Re: Selecting Rows Based on Column Values