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: spm_eeg_inv_rigidreg.m
    path of file: ./repos/spm
    
    the code of the file until where you have to start completion: function [M1] = spm_eeg_inv_rigidreg(data1, data2)
% Computes homogeneous transformation matrix based on two sets
% of points from two coordinate systems
%
% FORMAT [M1] = spm_eeg_inv_rigidreg(data1, data2)
% Input:
% data1      - locations of the first set of points corresponding to the
%            3D surface to register onto 
% data2      - locations of the second set of points corresponding to the
%            second 3D surface to be registered 
%__________________________________________________________________________

% Vladimir Litvak

    
function [M1] = spm_eeg_inv_rigidreg(data1, data2)
% Computes homogeneous transformation matrix based on two sets
% of points from two coordinate systems
%
% FORMAT [M1] = spm_eeg_inv_rigidreg(data1, data2)
% Input:
% data1      - locations of the first set of points corresponding to the
%            3D surface to register onto 
% data2      - locations of the second set of points corresponding to the
%            second 3D surface to be registered 
%__________________________________________________________________________

% Vladimir Litvak
% Copyright (C) 2008-2022 Wellcome Centre for Human Neuroimaging


M       = spm_detrend