MathGroup Archive 2006

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

Search the Archive

Re: Remove Indeterminate elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64309] Re: Remove Indeterminate elements
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Fri, 10 Feb 2006 02:14:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 2/9/06 at 2:44 AM, berbas at anadolu.edu.tr (Baris Erbas) wrote:

>I have been trying to remove some elements of a list which should
>be quite straightforward. The list is as follows:

>{{x1,y1},{x2,y2},.{xi,yi},{Indeterminate,Indeterminate},.{xn,yn}}.
>All the components are real numbers apart from some Indeterminate
>expressions. I want the list without the Indeterminate terms. I
>have been trying to use Delete with If command but cannot succeed.

>Can anyone help please?

Instead of Delete which needs to know the position of the element to be removed try DeleteCases, i.e.,

In[4]:=
data = {{x1, y1}, {x2, y2}, {xi, yi}, {Indeterminate, Indeterminate}, 
    {xn, yn}}; 

DeleteCases[data, {Indeterminate, _}]

Out[5]=
{{x1, y1}, {x2, y2}, {xi, yi}, {xn, yn}}

In your particular example, whenever Interminate occurred in the second position it also occurred in the first. If this is always the case then the second argument I used for DeleteCases will do what you want. But if this is not the case the second argument would need to be changed thusly


DeleteCases[data, {Indeterminate, _} | {_, Indeterminate]

Another approach to solving this problem assuming all of the (xn,yn} pairs consisted of numeric items would be to use Cases, i.e.,

In[15]:=
data = ReplacePart[
         Table[{Random[], Random[]}, {10}], 
         Indeterminate, {{4, 2}, {5, 1}, {2, 2}}]; 

Cases[data, {_?NumericQ, _?NumericQ}]

Out[16]=
{{0.08313958517187849, 
   0.2837232667317129}, 
  {0.8152400018945123, 
   0.4014387550777305}, 
  {0.18294719364877007, 
   0.2774241010494983}, 
  {0.7296820914209136, 
   0.8678526050128962}, 
  {0.07226920149008315, 
   0.08536415401470944}, 
  {0.242445899688783, 
   0.06375672253197655}, 
  {0.9124757124681858, 
   0.19757087686110195}}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Digital Image Processing: showing graylevel images in
  • Next by Date: Re: Number-Theory :: All-Digit Perfect Squares
  • Previous by thread: Re: Remove Indeterminate elements
  • Next by thread: Poisson equation