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: calculateThresholdsPFsessions.m
    path of file: ./repos/bspm/thirdparty/bramila/external/ISC_toolbox/ISCanalysis
    
    the code of the file until where you have to start completion: function calculateThresholdsPFsessions(Params)

% Compute critical thresholds from sumZPF null distributions for across
% session comparison.
%
% See also: RUNANALYSIS, INITPARAMS

% Last updated: 21.6.2011 by Jukka-Pekka Kauppi
% Tampere University of Technology
% Department of Signal Processing

    
function calculateThresholdsPFsessions(Params)

% Compute critical thresholds from sumZPF null distributions for across
% session comparison.
%
% See also: RUNANALYSIS, INITPARAMS

% Last updated: 21.6.2011 by Jukka-Pekka Kauppi
% Tampere University of Technology
% Department of Signal Processing
% e-mail: jukka-pekka.kauppi@tut.fi

Priv = Params.PrivateParams;
Pub = Params.PublicParams;
sessComps = ((Priv.nrSessions)^2-(Priv.nrSessions))/2;

critVals = [0.05 0.01 0.001];
r = 0;
for s = 0:Pub.nrFreqBands
    for k = 1:sessComps
        try
            load([Priv.PFsessionDestination 'band' num2str(s) 'valsPFsessComp' num2str(k)])
            vals1 = vals1(:)';
            vals2 = vals2(:)';
            vals = [vals1 vals2];
            vals = fliplr(sort(vals));
            for m = 1:length(critVals)
                Th(m) = vals(1 + floor(length(vals)*critVals(m)));
            end