In MATLAB I have a set of 5393280 points in the form of a decimal-valued vector (x,y,z). How do I represent them in a way that I can quickly collect all the points within some rectangular x-y domain?
Right now I'm representing them as a 3-column matrix, sorted by x-values, and using the following code to extract a rectangular region:
mtx_region = mtx_pointList( dxLowerBound < mtx_pointList(:,1) & ... dxUpperBound > mtx_pointList(:,1) & ... dyLowerBound < mtx_pointList(:,2) & ... dyUpperBound > mtx_pointList(:,2), : );
However, I suspect that this is slowing my code down considerably.
What is a better way?