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: arInitMC3Fields.m
    path of file: ./repos/d2d/arFramework3/Subfunctions
    
    the code of the file until where you have to start completion: % ar = arInitMC3Fields(ar)
% 
% This function checks whether all the required fields for mcmc in the ar 
% structure are present.
% 
%   ar  model struct which is used as global variable in D2D.

function ar = arInitMC3Fields(ar)
    ar              = checkForField(ar, 'mc3');
    % MC3 options
    mc3Defaults = { ... 
        {'nruns',                     10000}, ... 
        {'nburnin',                   0}, ...
        {'method',                    4}, ...
        {'exchange_method',           0}, ... 
        {
    
function checks whether all the required fields for mcmc in the ar 
% structure are present.
% 
%   ar  model struct which is used as global variable in D2D.

function ar = arInitMC3Fields(ar)
    ar              = checkForField(ar, 'mc3');
    % MC3 options
    mc3Defaults = { ... 
        {'nruns',                     10000}, ... 
        {'nburnin',                   0}, ...
        {'method',                    4}, ...
        {'exchange_method',           0}, ... 
        {'nthinning',                 1}, ...
        {'NumberOfChains',            1}, ...
        {'ManualScalingFactor',       0.1}, ...
        {'UseScaling',                1}, ... 
        {'TemperatureExponent',       4}, ...
        {'RegularizationThreshold',   1e-8}, ... 
        {'min_accept',                0.4}, ...
        {'max_accept',                0.7}, ... 
        {'Cmax',                      1e8}, ...
        {'Cmin',                      1e-15}, ...
        {'Cmod',                      1.01}, ...
        {'LengthOfAcceptanceTestChain', 25}, ...
        {'DecayParameter', 0.51}, ...
        };

    % Apply the default MC3 settings where no fields are present
    ar.mc3 = validateFields(ar.mc3, mc3Defaults, 'mc3');
end