The ICP algorithm takes two point clouds as an input and return the rigid transformation (rotation matrix R and translation vector T), that best aligns the point clouds.
[R,T] = icp(q,p,10);
Aligns the points of p to the points q with 10 iterations of the algorithm.
The transformation is then applied using
R*p + repmat(T,1,length(p));
The file has implemented both point to point and point to plane as well as a couple of other features such as extrapolation, weighting functions, edge point rejection, etc.
For an introductory text on the ICP algorithm and the implemented variants, see http://www2.imm.dtu.dk/~jakw/publications/bscthesis.pdf
Hans Martin Kjer & Jakob Wilm -- Evaluation of surface registration algorithms for PET motion correction