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: mne_prepare_inverse_operator.m
    path of file: ./repos/fieldtrip/external/mne
    
    the code of the file until where you have to start completion: function [inv] = mne_prepare_inverse_operator(orig,nave,lambda2,dSPM,sLORETA)
%
% [inv] = mne_prepare_inverse_operator(orig,nave,lambda2,dSPM,sLORETA)
%
% Prepare for actually computing the inverse
%
% orig        - The inverse operator structure read from a file
% nave        - Number of averages (scales the noise covariance)
% lambda2     - The regularization factor
% dSPM        - Compute the noise-normalization factors for dSPM?
% sLORETA     - Compute the noise-normalization factors for sLORETA?
%

%

    
function [inv] = mne_prepare_inverse_operator(orig,nave,lambda2,dSPM,sLORETA)
%
% [inv] = mne_prepare_inverse_operator(orig,nave,lambda2,dSPM,sLORETA)
%
% Prepare for actually computing the inverse
%
% orig        - The inverse operator structure read from a file
% nave        - Number of averages (scales the noise covariance)
% lambda2     - The regularization factor
% dSPM        - Compute the noise-normalization factors for dSPM?
% sLORETA     - Compute the noise-normalization factors for sLORETA?
%

%
%
%   Author : Matti Hamalainen, MGH Martinos Center
%   License : BSD 3-clause
%
%   Revision 1.4  2009/03/09 11:22:23  msh
%   Fixed the noise-normalization factors for the case where eigen leads come
%   already weighted
%
%   Revision 1.3  2008/05/26 10:49:26  msh
%   Update to incorporate the already weighted lead field basis
%
%   Revision 1.2  2006/05/05 19:37:47  msh
%   Fixed error in mne_make_projector.
%   Better detection of small eigenvalues for the projector.
%
%   Revision 1.1  2006/05/05 03:50:40  msh
%   Added routines to compute L2-norm inverse solutions.
%   Added mne_write_inverse_sol_stc to write them in stc files
%   Several bug fixes in other files
%
%

me='MNE:mne_prepare_inverse_operator';

global FIFF;
if isempty(FIFF)
    FIFF = fiff_define_constants();
end