03-12-2009 10:36 AM
Hello
I am having two 2 D array of elements. Array1 and Array2.
I take a value from Array2 and calculate its distance from all the elements in Array1. I need to get the element which is at the shortest distance from it. How is it posible?
I have made a VI.After calculating the distance how is it possible to check for the shortest and how to store that nearest value in an array??
please have a look
Thanks
Solved! Go to Solution.
03-12-2009 10:41 AM
Hi Nghtcrwlr,
if i understand it correct, then the "Array Min & Max" function should help.
Mike
03-12-2009 11:15 AM - edited 03-12-2009 11:19 AM
While I did not quite understand what kind of output you want, here's one possible solution that can probably point you in the right direction. Good luck!
I assume you want the value of the nearest array element and I assume by distance you mean the 2D distance between the two points in the complex plane. Other interpertations would be to get the array indices of the closest value, for example.
03-12-2009 11:27 AM
03-12-2009 01:17 PM
(See also) 🙂
03-12-2009 03:08 PM
Hello Everybody!!
I had tried the Max n Min function but it alone didnt do anything. With the stuff altenbach mentioned its wrking..thanks.....Its an easy way jus to take the differene and thefind tha absolute value instead of calculating as per the general formula. I am not quite clear with the part after finding the absolute value. Can you please make it a bit clear??/
Thanks
03-12-2009 03:21 PM - edited 03-12-2009 03:24 PM
Nghtcrwlr wrote:I am not quite clear with the part after finding the absolute value. Can you please make it a bit clear??/
After you get the 2D array of distances, we use array min/max to get the value and position of the smallest element.
Then we index in the original complex array to get the complex value.
03-12-2009 04:10 PM
Ok... now everythin is clear. I usually use Max & Min func only to get the maximum & minimum value... i hardly notice the max n min index frm it....
Thank you very much!!!