Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5888 > unrolled thread

simple question about removing elements from a table

Started by"Michael B. Heaney" <mheaney@gmail.com>
First post2011-10-26 21:39 +0000
Last post2011-10-28 09:39 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  simple question about removing elements from a table "Michael B. Heaney" <mheaney@gmail.com> - 2011-10-26 21:39 +0000
    Re: simple question about removing elements from a table Ray Koopman <koopman@sfu.ca> - 2011-10-27 10:45 +0000
    Re: simple question about removing elements from a table "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-10-28 09:39 +0000

#5888 — simple question about removing elements from a table

From"Michael B. Heaney" <mheaney@gmail.com>
Date2011-10-26 21:39 +0000
Subjectsimple question about removing elements from a table
Message-ID<j89umn$2e$1@smc.vnet.net>
Hi,

I have a data table:

data={{-0.5, 0.0321787}, {-0.489, 0.0321691}, {-0.478,
0.032211}, {-0.467, 0.0321723}, {-0.456, 0.0322448}, {-0.444, 0.0321498},
{-0.433, 0.032132}, {-0.422, 0.0321804}, {-0.411, 0.0322158},
{-0.4, 0.0320886},  {-0.233,  0.0320596},  {0.567, 0.00286087}, {0.578,
-0.00143633}, {0.589, -0.00592979}, {0.6, -0.0113609}}
I want to remove all of the elements that have a positive first number, to
get:

datasubset={{-0.5, 0.0321787}, {-0.489, 0.0321691}, {-0.478,
0.032211}, {-0.467, 0.0321723}, {-0.456, 0.0322448}, {-0.444, 0.0321498},
{-0.433, 0.032132}, {-0.422, 0.0321804}, {-0.411, 0.0322158},
{-0.4, 0.0320886},  {-0.233,  0.0320596}}

 How do I do this?

Thanks,

Michael
-- 
------------------------------------------------------------
Michael B. Heaney
3182 Stelling Drive
Palo Alto, CA 94303 USA
mheaney@alum.mit.edu
www.linkedin.com/in/michaelbheaney
------------------------------------------------------------

[toc] | [next] | [standalone]


#5940

FromRay Koopman <koopman@sfu.ca>
Date2011-10-27 10:45 +0000
Message-ID<j8bcol$8ud$1@smc.vnet.net>
In reply to#5888
On Oct 26, 2:39 pm, "Michael B. Heaney" <mhea...@gmail.com> wrote:
> Hi,
>
> I have a data table:
>
> data={{-0.5, 0.0321787}, {-0.489, 0.0321691}, {-0.478,
> 0.032211}, {-0.467, 0.0321723}, {-0.456, 0.0322448}, {-0.444, 0.0321498},
> {-0.433, 0.032132}, {-0.422, 0.0321804}, {-0.411, 0.0322158},
> {-0.4, 0.0320886},  {-0.233,  0.0320596},  {0.567, 0.00286087}, {0.578,
> -0.00143633}, {0.589, -0.00592979}, {0.6, -0.0113609}}
> I want to remove all of the elements that have a positive first number, to
> get:
>
> datasubset={{-0.5, 0.0321787}, {-0.489, 0.0321691}, {-0.478,
> 0.032211}, {-0.467, 0.0321723}, {-0.456, 0.0322448}, {-0.444, 0.0321498},
> {-0.433, 0.032132}, {-0.422, 0.0321804}, {-0.411, 0.0322158},
> {-0.4, 0.0320886},  {-0.233,  0.0320596}}
>
>  How do I do this?

DeleteCases[data,{_?Positive,_}]

[toc] | [prev] | [next] | [standalone]


#5957

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2011-10-28 09:39 +0000
Message-ID<j8dt84$kdr$1@smc.vnet.net>
In reply to#5888
Select[data, #1[[1]] <= 0 & ]

--- Wolfgang


"Michael B. Heaney" <mheaney@gmail.com> schrieb im Newsbeitrag 
news:j89umn$2e$1@smc.vnet.net...
> Hi,
>
> I have a data table:
>
> data={{-0.5, 0.0321787}, {-0.489, 0.0321691}, {-0.478,
> 0.032211}, {-0.467, 0.0321723}, {-0.456, 0.0322448}, {-0.444, 
> 0.0321498},
> {-0.433, 0.032132}, {-0.422, 0.0321804}, {-0.411, 0.0322158},
> {-0.4, 0.0320886},  {-0.233,  0.0320596},  {0.567, 0.00286087}, 
> {0.578,
> -0.00143633}, {0.589, -0.00592979}, {0.6, -0.0113609}}
> I want to remove all of the elements that have a positive first 
> number, to
> get:
>
> datasubset={{-0.5, 0.0321787}, {-0.489, 0.0321691}, {-0.478,
> 0.032211}, {-0.467, 0.0321723}, {-0.456, 0.0322448}, {-0.444, 
> 0.0321498},
> {-0.433, 0.032132}, {-0.422, 0.0321804}, {-0.411, 0.0322158},
> {-0.4, 0.0320886},  {-0.233,  0.0320596}}
>
> How do I do this?
>
> Thanks,
>
> Michael
> -- 
> ------------------------------------------------------------
> Michael B. Heaney
> 3182 Stelling Drive
> Palo Alto, CA 94303 USA
> mheaney@alum.mit.edu
> www.linkedin.com/in/michaelbheaney
> ------------------------------------------------------------

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web