MathGroup Archive 2012

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

Search the Archive

Re: How to use Pick[]; Is this a bug?


Am 14.08.2012 10:22, schrieb benp84 at gmail.com:
> In[1]:=  Pick[{1, 2, 3, 4, 5}, {9, 0, 7, 0, 6}, Except[0]]
> Out[1]:= {1, 2, 3, 4, 5}
>
> Shouldn't this return {1, 3, 5}, since these are the corresponding elements that match Except[0]?
>

Hi,

  the whole list {9, 0, 7, 0, 6} is unequal to the Integer 0.

What you want is:

Pick[{1, 2, 3, 4, 5}, {9, 0, 7, 0, 6}, Except[0, _Integer]]

Cheers,
  Peter



  • Prev by Date: How to make field lines in VectorPlot3D white
  • Next by Date: Re: NDSolve curve - obtain single value from curve at t:=d
  • Previous by thread: Re: How to use Pick[]; Is this a bug?
  • Next by thread: Re: How to use Pick[]; Is this a bug?