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_compute_single_trial_amp.m
    path of file: ./repos/gift/GroupICAT/icatb/icatb_helper_functions
    
    the code of the file until where you have to start completion: function [beta_weights, eventAvg] = icatb_compute_single_trial_amp(tc, TR, windowSize, selectedOnset, plotResults)
%% Compute single trial amplitudes on fMRI data. This code is an
% implementation of Dr. Eichele's work.
%
% Inputs:
% 1. tc - Scaled ICA timecourse
% 2. TR - Interscan timeinterval
% 3. windowSize - Window size
% 4. selectedOnset - Selected onset
%
% Outputs:
%

icatb_defaults;

    
function [beta_weights, eventAvg] = icatb_compute_single_trial_amp(tc, TR, windowSize, selectedOnset, plotResults)
%% Compute single trial amplitudes on fMRI data. This code is an
% implementation of Dr. Eichele's work.
%
% Inputs:
% 1. tc - Scaled ICA timecourse
% 2. TR - Interscan timeinterval
% 3. windowSize - Window size
% 4. selectedOnset - Selected onset
%
% Outputs:
%

icatb_defaults;
global FONT_COLOR;
global UI_FONTUNITS;
global UI_FONTNAME;
global UI_FS;

%% Get event average (Deconvolution method)
[eventAvg, convolved_tc, selectedOnset] = icatb_calculate_eventAvg_deconv(tc, TR, windowSize, selectedOnset);

if (~exist('plotResults', 'var'))
    plotResults = 0;
end