Documentation of thin


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

out1 = thin(a, inc);

Help text


  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.


Cross-Reference Information

This function is called by

Listing of function thin

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;