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_run_dcm_bms.m
    path of file: ./repos/spm12/config
    
    the code of the file until where you have to start completion: function out = spm_run_dcm_bms(job)
% Compare DCMs on the basis of their log-evidences
% Four methods are available to identify the best among alternative models:
%
%  (1) single subject BMS using Bayes factors
%      (see Penny et al, NeuroImage, 2004)
%  (2) fixed effects group BMS using group Bayes factors
%      (see Stephan et al, NeuroImage, 2007)
%  (3) random effects group BMS using exceedance probabilities
%      (see Stephan et al, NeuroImage, 2009)
%  (4) comparing model families
%      (see Penny et al, PLOS-CB, 2010)
%

    
function out = spm_run_dcm_bms(job)
% Compare DCMs on the basis of their log-evidences
% Four methods are available to identify the best among alternative models:
%
%  (1) single subject BMS using Bayes factors
%      (see Penny et al, NeuroImage, 2004)
%  (2) fixed effects group BMS using group Bayes factors
%      (see Stephan et al, NeuroImage, 2007)
%  (3) random effects group BMS using exceedance probabilities
%      (see Stephan et al, NeuroImage, 2009)
%  (4) comparing model families
%      (see Penny et al, PLOS-CB, 2010)
%
% Note: All functions use the negative free energy (F) as an approximation
% to the log model evidence.
%__________________________________________________________________________
% Copyright (C) 2009-2015 Wellcome Trust Centre for Neuroimaging

% CC Chen & Maria Joao Rosa
% $Id: spm_run_dcm_bms.m 7101 2017-06-08 12:36:13Z peter $


SVNid = '$Rev: 7101 $';

%-Say hello
%--------------------------------------------------------------------------
spm('FnBanner',mfilename,SVNid);

%-Input parameters
%--------------------------------------------------------------------------
fname   = 'BMS.mat';                     % Output filename
fname   = fullfile(job.dir{1},fname);    % Output filename (inc. directory)
ld_f    = ~isempty(job.load_f{1});       % Log-evidence file
ld_msp  = ~isempty(job.model_sp{1});     % Model space file
bma_do  = isfield(job.bma,'bma_yes');    % Compute BMA
data_se = ~isempty(job.sess_dcm);        % DCM files

out.bmsmat = {''};

% check whether a BMS.mat file exists in the selected directory
if exist(fname,'file')
    str = {'Current directory contains a BMS file:',...
        'Continuing will overwrite existing file !!'};
    if spm_input(str,1,'bd','stop|continue',[1,0],1,mfilename);
        fprintf('%-40s: %30s\n\n',...
            'BMS stoped...existing BMS file in the selected directory',...
            spm('time'));
        Fgraph  = spm_figure('GetWin','Graphics');
        spm_clf(Fgraph);
        return
    end