annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Point nearest of all in an array

Risolto!
Vai alla soluzione

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 

 

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Messaggio 1 di 8
4.959Visualizzazioni

Hi Nghtcrwlr,

if i understand it correct, then the "Array Min & Max" function should help.

 

Mike

0 Kudos
Messaggio 2 di 8
4.954Visualizzazioni
Soluzione
Accettato da Nghtcrwlr

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.

Message Edited by altenbach on 03-12-2009 09:19 AM
Scarica tutti
Messaggio 3 di 8
4.939Visualizzazioni
It is possible that I have the meaning of array1 and array2 reversed in my code, so please double-check. 😄
0 Kudos
Messaggio 4 di 8
4.930Visualizzazioni
0 Kudos
Messaggio 5 di 8
4.901Visualizzazioni

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

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Messaggio 6 di 8
4.890Visualizzazioni

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.

Message Edited by altenbach on 03-12-2009 01:24 PM
0 Kudos
Messaggio 7 di 8
4.884Visualizzazioni

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!!!Smiley Felice

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Messaggio 8 di 8
4.868Visualizzazioni