07-05-2021 05:20 AM
i have all the points(x,y cluster) shown in green in 1D array i want to convert to 2D array, where each row contain the points which are X distance from each other, hence separating as per the location, assume each point in a region is X distance from each other.
Solved! Go to Solution.
07-05-2021 07:47 AM
I'm assuming you want the distance condition to be a 'less than or equal to', rather than an exact match to distance 'X'.
One way would be to start with the first point, find points meeting the above constraint, and loop through the remaining points accordingly.
Essentially, for any point (x_i, y_i) you are looking for point (x_k, y_k) that meets the criterion
sqrt ((x_k - x_i)^2 + (y_k - y_i)^2) <= X
sqrt = square root.
^2 = squared
You'll have to figure out the 2d array for yourself, as I'm not sure your data set will guarantee an equal number of points present in each 'group' of points as shown in your picture.
07-05-2021 10:00 AM
I would convert your 1D array of XY clusters to a 1D array of complex with x=RE and y=IM.
Now all pairwise distances can be easily obtained by the absolute value of their difference.
Instead of the distance x in your picture (please call it something else because x is already used for one of the axes! Try e.g. "r"), it might be better to define the maximum distance in each cluster. Do you know how many clusters you expect? Can you guarantee a significant distance between clusters?
Usually you'll get much more specific help if you would attach a small VI containing typical data. Please do so.
07-05-2021 10:21 AM
Altenbach's is a much more elegant solution, achieving the same operation and result through complex number algebra. Nice one!
07-05-2021 10:59 AM
Here's what I had in mind. Some of the constants probably need to be tuned. Make sure you understand every single part!
07-05-2021 11:06 PM - edited 07-05-2021 11:43 PM
Sorry, I should have attached a vi, here is one of the data set. and about the number of data expected is not predefined, number of points in each region is not equal. and my labview bersion is 2014 could you please downgrade and upload. okey i have converted to complex number still it is not working. as from provided set of data u can see there are 2 lines i need to find in any angle,
07-06-2021 05:44 AM
Please find attached Altenbach's VI saved for LV 2014.
07-30-2021 04:14 AM
Thank you, i got somthing to learn i havent used complex numbers still. but in current situation i cant use them its not only these 2 data (X,Y) in cluster i posted it for simplicity. but here is the sol. i came up with.