MathGroup Archive 2011

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

Search the Archive

Re: With Nearest

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121094] Re: With Nearest
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 28 Aug 2011 04:04:03 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 8/27/11 at 8:17 AM, graser at gmail.com (graser) wrote:

>Dear Mathematica group, I have a simple question for you. Let's say
>there is an array or matrix like
>
>AA = {{1.3, 1.5}, {21.5, 23.6}, {10, 19}};
>
>If I want to extract a list whose second element is close to 20, How
>can I do it with Nearest function?

In[22]:= Nearest[AA, 20,
  DistanceFunction -> (Abs[Last@#1 - Last@#2] &)]

Out[22]= {{10, 19}}





  • Prev by Date: Re: With Nearest
  • Next by Date: Re: With Nearest
  • Previous by thread: Re: With Nearest
  • Next by thread: Re: With Nearest