image thumbnail

Local Neighborhood

version 1.2.0.0 (1.39 KB) by FDR
Filters data set to only include local points around a reference.

172 Downloads

Updated 25 Nov 2011

View License

Very short and simple function to take a data set and to filter out the values that don't fall into the local neighborhood (of a specified norm radius with a specified norm) of some specified reference point. I've often had the need to do this, and thought that it might be useful for some people, as a lot of important assumptions are local and cannot be applied to all the data available.

The file works as follows:

1) All the data points that fall outside the infinity norm of the reference point and norm size are immediately removed, as this is computationally cheap and can take out large parts of the region (points in all other norms are included in the infinity, so the good points are kept).

2) The norm is then calculated for the points that remain, and those that fall outside the local neighborhood are culled.

3) The remaining points are sorted based on distance away from the reference.

Results will vary with computer/data, but in general this shouldn't take more than a few seconds, provided that the data matrix is dense and something that MATLAB can store. It would probably take longer for very large sparse matrices.

Cite As

FDR (2022). Local Neighborhood (https://www.mathworks.com/matlabcentral/fileexchange/33846-local-neighborhood), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!