Dear David,
Thank you for your reply. That was a good math lesson though :-). I believe
your method would work too. Someone sent me a vi, just using the property
node of the XY graph, there is a property called "Cursor.index" would
directly output the index. So I guess LabVIEW has done all the hard work
internally for us already.

Irene He
www.geocities.com/irene_he
www.hytekautomation.com

----- Original Message ----- 
From: "David Ferster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 08, 2004 11:25 AM
Subject: Re: Index of XY graph


> What info are you starting from? Assuming you have the X and Y values
> of the point whose index you want (call them A and B), then calculate
> the squared distance of each point in the graph from (A,B) and find
> the minimum (squared) distance.
>
> D = ((X-A)^2 + (Y-B)^2)
>
> Here, X and Y are 1-D arrays of the x and y values of all points in
> the graph. D becomes is an array of distances squared.
>
> Now search D for 0's if you know A and B are exactly on a point. Or
> use the Array Max and Min function if you just want to find the point
> closest to A,B, for example, if (A,B) is the position of a cursor
> placed near the point. In either case, you get an index of the point
> in the graph closest to (A,B).
>
> David
>
>
>
> >Dear List,
> >Does anyone know how to find out the index of a point
> >in a XY graph?
> >Thank you.
> >Irene
> >
> >=====
> >Irene He
> >
> >www.geocities.com/irene_he
> >www.hytekautomation.com
>
>
> -- 
> David Ferster
> Actimetrics, Inc.
> 1621 Elmwood Ave., Wilmette, IL 60091
> http://www.actimetrics.com
> 847/922-2643 Phone
> 847/589-8103 FAX
>
>
>




Reply via email to