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: reconstr_pca1.m
    path of file: ./repos/HRTF-Individualization/model/matlabcode/functions/depricated/gui_exp
    
    the code of the file until where you have to start completion: function [hrir_reconstr_left,hrir_reconstr_right] = reconstr_pca1(hObject,eventdata,handles,weights_reconstruct)

global mn
global pcs
global MEAN_SUB
global current_positions
global hrir_db_length
global DB
global fs

% Gui Elements
select_pcs = get_pcs_number(hObject, eventdata, handles);
pca_mode = get(handles.pca_mode,'Value');
play_positions = get(handles.play_positions,'Value');
sol_index = get(handles.solution_subject,'Value');
sol_sub_value = get(handles.solution_subject,'Value');
sol_sub_list = str2num(get(handles.solution_subject,'String'));
sol_sub = sol_sub_list(sol_sub_value);

% PCA Reconstruction
data_reconstruct = (pcs(:,1:select_pcs) * weights_reconstruct(:,1:select_pcs)')' + mn;

% Init
c = 0;
signal_length = size(data_reconstruct,2)/length(current_positions)/2;

hrtf_mag_left = zeros(signal_length,length(current_positions));

    
function [hrir_reconstr_left,hrir_reconstr_right] = reconstr_pca1(hObject,eventdata,handles,weights_reconstruct)

global mn
global pcs
global MEAN_SUB
global current_positions
global hrir_db_length
global DB
global fs

% Gui Elements
select_pcs = get_pcs_number(hObject, eventdata, handles);
pca_mode = get(handles.pca_mode,'Value');
play_positions = get(handles.play_positions,'Value');
sol_index = get(handles.solution_subject,'Value');
sol_sub_value = get(handles.solution_subject,'Value');
sol_sub_list = str2num(get(handles.solution_subject,'String'));
sol_sub = sol_sub_list(sol_sub_value);

% PCA Reconstruction
data_reconstruct = (pcs(:,1:select_pcs) * weights_reconstruct(:,1:select_pcs)')' + mn;

% Init
c = 0;
signal_length = size(data_reconstruct,2)/length(current_positions)/2;

hrtf_mag_left = zeros(signal_length,length(current_positions));
hrtf_mag_right = zeros(signal_length,length(current_positions));

hrir_min_left = zeros(hrir_db_length,length(current_positions));
hrir_min_right = zeros(hrir_db_length,length(current_positions));

hrir_left_no = zeros(signal_length*2,length(current_positions));
hrir_right_no = zeros(signal_length*2,length(current_positions));

hrir_reconstr_left = zeros(hrir_db_length,length(current_positions));
hrir_reconstr_right = zeros(hrir_db_length,length(current_positions));
    
    
    for pos=1:length(current_positions)

        if (pca_mode <= 2) % PCA DTF MODE

            % Split DTF
            c=c+1;
            dtf_mag_l = data_reconstruct((c-1)*signal_length+1:c*signal_length)';

            c=c+1;
            dtf_mag_r = data_reconstruct((c-1)*signal_length+1:c*signal_length)';

            % DTF -> HRTF
            if (pca_mode == 1) && (get(handles.add_mean,'Value') == 1)
            % add subjects mean / use all means
            hrtf_mag_left(:,pos) = dtf_mag_l+ squeeze(mean(MEAN_SUB(:,1,1,:),1));
            hrtf_mag_right(:,pos) = dtf_mag_r + squeeze(mean(MEAN_SUB(:,1,2,:),1));
            end