MathGroup Archive 2011

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

Search the Archive

Re: DeleteCases

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123908] Re: DeleteCases
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Fri, 30 Dec 2011 07:02:31 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jdh6g8$km5$1@smc.vnet.net>
  • Reply-to: nma at 12000.org

On 12/29/2011 1:56 AM, umberto wrote:
> Dear All,
>
> I have tables of this type:
>
> {{{{0.912546, 0.1081}, -0.0206463}, {{0.186044, 0.835368}, -0.0214121},
> {{0.0841709, -0.676585}, 1.59241}}, {{{-0.976965, -0.339164, -0.210989},
> 2.52712}, {{0.13978, -0.995106, 0.756386}, 1.09894}, {{-0.313147, -0.432759,
> 0.207548}, 1.53836}}}
>
> I'd like to delete from the table elements of the type: {{x, x, ...., x}, y}
> when y is not in the interval [-1, 1].
> I was trying with DeleteCases, but with no success.
> Could you, please, help me.
> best regards
> Umberto
>

may be one way:

------------------------------------
cleanedData = DeleteCases[data, {x_, y_} /; y < -1 || y > 1, {2}]
-----------------------------------

{{{{0.912546, 0.1081}, -0.0206463},
{{0.186044,0.835368}, -0.0214121}},
{}}

If you do not like the empty {} entry left, you can remove it

----------------------------------------------
cleanedData = DeleteCases[cleanedData, {}]
-----------------------------------------------
{{{{0.912546, 0.1081}, -0.0206463},
{{0.186044, 0.835368}, -0.0214121}}}


--Nasser






  • Prev by Date: Re: FindRoot and replacement rule
  • Next by Date: computing integral lines
  • Previous by thread: Re: DeleteCases
  • Next by thread: Re: DeleteCases