You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: procrustes_trans.m
    path of file: ./repos/bspm/thirdparty/spm12/external/fieldtrip/private
    
    the code of the file until where you have to start completion: function [h] = procrustes_trans(input,target)

% PROCRUSTES_TRANS returns the homogenous coordinate transformation matrix
% that warps the specified input points to the target points. 
%
% Use as
%   [h] = procrustes_trans(input, target) 
% where
%   input   Nx3 matrix with coordinates
%   target  Nx3 matrix with coordinates
% 
% The algorithm used for the calculation of the rotation matrix is knonwn
% as the Procrustes method. Its use for MEG coordinate transformation has 
% been suggested in Fuchs et al. TBME vol. 42, 1995, p. 416ff.
% 
% See also WARP_OPTIM, HEADCOORDINATES

% Copyright (C) 2010, Tilmann Sander-Thoemmes
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,

    
function [h] = procrustes_trans(input,target)

% PROCRUSTES_TRANS returns the homogenous coordinate transformation matrix
% that warps the specified input points to the target points. 
%
% Use as
%   [h] = procrustes_trans(input, target) 
% where
%   input   Nx3 matrix with coordinates
%   target  Nx3 matrix with coordinates
% 
% The algorithm used for the calculation of the rotation matrix is knonwn
% as the Procrustes method. Its use for MEG coordinate transformation has 
% been suggested in Fuchs et al. TBME vol. 42, 1995, p. 416ff.
% 
% See also WARP_OPTIM, HEADCOORDINATES

% Copyright (C) 2010, Tilmann Sander-Thoemmes
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

ninp = size(input,1);
ntarg = size(target,1);

% do basic checks
if ninp ~= ntarg,     
    ft_error('you must specify same number of points for input and target');
end