Pads or crops I appropriately so that size(IC)==dims. For each dimension d, if size(I,d) is larger then dims(d) then symmetrically crops along d (if cropping amount is odd crops one more unit from the start of the dimension). If size(I,d) is smaller then dims(d) then symmetrically pads along d with padEl (if padding amount is even then pads one more unit along the start of the dimension). USAGE IC = arrayToDims( I, dims, [padEl] ) INPUTS I - n dim array to crop window from (for arrays can only crop) dims - dimensions to make I padEl - [0] element with which to pad OUTPUTS IC - cropped array EXAMPLE I=randn(10); delta=1; IC=arrayToDims(I,size(I)-2*delta); See also ARRAYCROP, PADARRAY Piotr's Image&Video Toolbox Version 2.0 Copyright 2012 Piotr Dollar. [pdollar-at-caltech.edu] Please email me if you find bugs, or have suggestions or questions! Licensed under the Simplified BSD License [see external/bsd.txt]