File Exchange

image thumbnail


version 1.1 (2.09 KB) by

crop arrays with axis-aligned minimum bounding box



View License

Often I have to extract a subset of a two-dimensional array for further analysis. Usually I do this with logical indexing. But most often the problem with logical indexing is that I get a column vector which I then have to reshape or index into a new array.

cropmat solves this problem. The function crops a subset of an array based on the axis-aligned minimum bounding rectangle. One advantage is that you can perform the operation on several matrices (e.g. coordinate matrices generated by meshgrid) at one time. Moreover, cropmat works on arrays with an arbitrary number of dimensions.

Comments and Ratings (1)



changed name of the function from clipmat to cropmat.

MATLAB Release
MATLAB 7.8 (R2009a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video