Finding directional nearest neighbors (N, E, S, W) for x/y data stored in struct arrays
1 view (last 30 days)
Show older comments
I am evaluating locations of foundations for solar racking for large sites. The way this data comes to me is in "blocks." For each block, I get some key information and then calculate the locations of all foundations within this block. The initial and calculated information is segregated into structs for each block. All the data is initially calculated on a per column (matrix) basis, and then each variable, x, y, z location is reshaped into a single column array for spreadsheet output.
The foundation location x's (eastings) and y's (northings) are not necessarily rectilinear. For a given row, all X's will be held constant, but when comparing one row's y's with anothers there will be slight variance.
What I am looking to do is to locate the four cardinal nearest neighbors of each interior foundation. I feel like dsearchn or a similar function should be easily manipulated to give me what I am looking for, but for the life of me I cannot figure it out.
Does anybody have any ideas on how this can be achieved within the above described structure? I am relatively new to matlab, but so far it's been very intuitive. I've included a screen grab of the foundation locations (colored by struct) here. Any help would be greatly appreciated.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641760/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/641760/image.png)
2 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!