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


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

Re: With Nearest

Started byHeike Gramberg <heike.gramberg@gmail.com>
First post2011-08-28 08:05 +0000
Last post2011-08-28 08:05 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: With Nearest Heike Gramberg <heike.gramberg@gmail.com> - 2011-08-28 08:05 +0000

#4621 — Re: With Nearest

FromHeike Gramberg <heike.gramberg@gmail.com>
Date2011-08-28 08:05 +0000
SubjectRe: With Nearest
Message-ID<j3csrp$5j4$1@smc.vnet.net>
You'll need to specify a suitable DistanceFunction, for example

AA = {{1.3, 1.5}, {21.5, 23.6}, {10, 19}};
Nearest[AA, 20, DistanceFunction :> (Norm[#2[[2]] - #1] &)]

Heike.

On 27 Aug 2011, at 14:17, 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?
> Or is there any other method possible?
> ( In this case, the answer should be {10, 19} )
> 
> Thanks!
> 
> 

[toc] | [standalone]


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


csiph-web