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_pca2.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_pca2( hObject,eventdata,handles,weights_reconstruct )

global pcs
global mn
global MEAN_SUB
global hrir_db_length
global DB
global measured_available
global fs

select_pcs = get_pcs_number(hObject, eventdata, handles);
pca_position = get(handles.position,'Value');
pca_mode = get(handles.pca_mode,'Value');
sol_sub = get(handles.solution_subject,'Value');

% Store adjusted weights in GLOBAL_SCORES

if (pca_mode <= 2) % PCA DTF MODE

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

global pcs
global mn
global MEAN_SUB
global hrir_db_length
global DB
global measured_available
global fs

select_pcs = get_pcs_number(hObject, eventdata, handles);
pca_position = get(handles.position,'Value');
pca_mode = get(handles.pca_mode,'Value');
sol_sub = get(handles.solution_subject,'Value');

% Store adjusted weights in GLOBAL_SCORES

if (pca_mode <= 2) % PCA DTF MODE
    
    % DTF
    reconstruct_left = (pcs(:,1:select_pcs) * weights_reconstruct(:,1:select_pcs)')' + mn;
    
    % HRTF
    if (get(handles.pca_mode,'Value') == 1) && (get(handles.add_mean,'Value') == 1)
    % subjects mean, all subjects
    hrtf_mag_left = squeeze(mean(MEAN_SUB(:,1,1,:),1))' + reconstruct_left;
    hrtf_mag_right = squeeze(mean(MEAN_SUB(:,1,1,:),1))' + reconstruct_left;
    end