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: lbex.m
    path of file: ./repos/fieldtrip/private
    
    the code of the file until where you have to start completion: function [sourcemodel] = lbex(cfg, sourcemodel)

% This function will add the field "subspace" to the sourcemodel definition.
%
% The subspace projection is based on the LBEX (local basis expansion)
% method.

% set the defaults
cfg.lbex       = ft_getopt(cfg, 'lbex',       3); % this is a distance, in units of sourcemodel.pos

    
function [sourcemodel] = lbex(cfg, sourcemodel)

% This function will add the field "subspace" to the sourcemodel definition.
%
% The subspace projection is based on the LBEX (local basis expansion)
% method.

% set the defaults
cfg.lbex       = ft_getopt(cfg, 'lbex',       3); % this is a distance, in units of sourcemodel.pos
cfg.lbexeigtol = ft_getopt(cfg, 'lbexeigtol', 1000*eps);
cfg.feedback   = ft_getopt(cfg, 'feedback',   'text');
cfg.keep       = ft_getopt(cfg, 'keep',       'all');

if isequal(cfg.keep, 'all')
  cfg.keep = sourcemodel.inside;
else
  if ~islogical(cfg.keep)
    keep = false(size(sourcemodel.pos,1),1);
    keep(cfg.keep) = true;
    cfg.keep = keep;
  end