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: icatb_spatial_temp_regress.m
    path of file: ./repos/gift/GroupICAT/icatb/icatb_helper_functions
    
    the code of the file until where you have to start completion: function icatb_spatial_temp_regress(compFiles, inputFiles, varargin)
%% Backreconstruct subject components using spatial-temporal regression
%
%
% Inputs:
% 1. compFiles - Group or aggregate component files (full path) in character array format.
% 2. inputFiles - Original data files (full path) in a cell array where each cell can contain a character array of images like
% 3D analyze or 3D Nifti.
% 3. varargin - Optional parameters are passed in pairs. Here is the
% description of optional parameters
%   a. outputDir - Output directory
%   b. format - Output format. Options are .nii, .img or .mat
%   c. outputPrefix - Output prefix.
%
%
% Outputs:
% Individual subject component images are written in the output directory in 4D Nifti format or 3D
% analyze format.
%
% Example:
% compFiles = {'E:\Multiple_sub_Multiple_sess\sens\Sensorimotor_agg__component_ica_018.img', 'E:\Multiple_sub_Multiple_sess\sens\Sensorimotor_agg__component_ica_019.img'};
% inputFiles = {'F:\smr1\swSm_nifti.nii', 'F:\smr2\swSm_nifti.nii'};
% icatb_spatial_temp_regress(compFiles, inputFiles, 'outputDir', 'E:\Multiple_sub_Multiple_sess\results', 'format', '.nii', 'outputPrefix', 'test');


try
    warning('off', 'MATLAB:dispatcher:ShadowedMEXExtension');
catch
end

%% Load defaults
icatb_defaults;
global SUBJECT_ICA_AN3_FILE;
global SESSION_POSTFIX;
global COMPONENT_NAMING;

    
function icatb_spatial_temp_regress(compFiles, inputFiles, varargin)
%% Backreconstruct subject components using spatial-temporal regression
%
%
% Inputs:
% 1. compFiles - Group or aggregate component files (full path) in character array format.
% 2. inputFiles - Original data files (full path) in a cell array where each cell can contain a character array of images like
% 3D analyze or 3D Nifti.
% 3. varargin - Optional parameters are passed in pairs. Here is the
% description of optional parameters
%   a. outputDir - Output directory
%   b. format - Output format. Options are .nii, .img or .mat
%   c. outputPrefix - Output prefix.
%
%
% Outputs:
% Individual subject component images are written in the output directory in 4D Nifti format or 3D
% analyze format.
%
% Example:
% compFiles = {'E:\Multiple_sub_Multiple_sess\sens\Sensorimotor_agg__component_ica_018.img', 'E:\Multiple_sub_Multiple_sess\sens\Sensorimotor_agg__component_ica_019.img'};
% inputFiles = {'F:\smr1\swSm_nifti.nii', 'F:\smr2\swSm_nifti.nii'};
% icatb_spatial_temp_regress(compFiles, inputFiles, 'outputDir', 'E:\Multiple_sub_Multiple_sess\results', 'format', '.nii', 'outputPrefix', 'test');


try
    warning('off', 'MATLAB:dispatcher:ShadowedMEXExtension');
catch
end

%% Load defaults
icatb_defaults;
global SUBJECT_ICA_AN3_FILE;
global SESSION_POSTFIX;
global COMPONENT_NAMING;
global TIMECOURSE_NAMING;

outputPrefix = 'STR';
outputFormat = '.nii';
dummy_scans = 0;

%% Loop over variables
for n = 1:2:length(varargin)
    if (strcmpi(varargin{n}, 'outputdir'))
        outputDir = varargin{n + 1};
    elseif (strcmpi(varargin{n}, 'format'))
        outputFormat =  varargin{n + 1};
    elseif (strcmpi(varargin{n}, 'outputprefix'))
        outputPrefix = varargin{n + 1};
    elseif (strcmpi(varargin{n}, 'preproc_type'))
        preproc_type = varargin{n + 1};
    elseif (strcmpi(varargin{n}, 'dummy_scans'))
        dummy_scans = varargin{n + 1};
    end
end
%% End of loop over variables

%% Output directory
if (~exist('outputDir', 'var'))
    outputDir = icatb_selectEntry('typeEntity', 'directory', 'title', 'Select output directory to save results ...');
end