Global Index (short | long) | Local contents | Local Index (short | long)
out1 = thin(a, inc);
out1 = thin(in1, inc); Thin will thin the matrix in1 by taking every inc element in each direction. If in1 is a vector, it will just take every other element.
function out1 = thin(a, inc); dims = ndims(a); if (dims ~= length(inc) & length(inc) ~= 1); error('inc should have have either 1, or ndims(in1) elements') elseif (dims ~= length(inc) & length(inc) == 1); inc = inc * ones(1, dims); elseif (dims > 3) error('Sorry, ndims(in1) > 3 not supported.') end; if dims == 1; out1 = a(1:inc:length(a)); elseif dims == 2; out1 = a(1:inc(1):size(a,1), 1:inc(2):size(a,2)); elseif dims == 3; out1 = a(1:inc(1):size(a,1), 1:inc(2):size(a,2), 1:inc(3):size(a,3)); end;