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: myPLS_permut.m
    path of file: ./repos/CBIG/external_packages/matlab/non_default_packages/PLS_MIPlab
    
    the code of the file until where you have to start completion: function pvals_LC = myPLS_permut(X,Y,U,S,nPerms,grouping,normalization_img,normalization_behav,seed)

% Permutation testing over singular values obtained with PLS
% Rows (subjects) of Y are permuted within each diagnostic group
%
% Inputs:
% - X                    : N x M matrix, N is #subjects, M is #FC 
% - Y                    : N x B matrix, N is #subjects, B is #behaviors
% - U                    : B x L matrix, behavior saliences
% - S                    : L x L matrix, singular values
% - nPerms               : number of permutations
% - grouping             : N x 1 vector, subject grouping 
% - normalization_img    : normalization options for FC data
% - normalization_behav  : normalization options for behavior data
%                          0 = no normalization
%                          1 = zscore across all subjects
%                          2 = zscore within groups (default)
%                          3 = std normalization across subjects (no centering)
%                          4 = std normalization within groups (no centering)
% - seed                 : seed for random number generator, e.g. 1
%                          (default is 1000)
%
% Outputs:
% - pvals_LC             : p-values for each latent component
%
% Written by Valeria Kebets and the MIPlab, with subfunctions borrowed
% from PLS toolbox by Rotman Baycrest
% (https://www.rotman-baycrest.on.ca/index.php?section=84)

% Set random number generator 
if isempty(seed)

    
function pvals_LC = myPLS_permut(X,Y,U,S,nPerms,grouping,normalization_img,normalization_behav,seed)

% Permutation testing over singular values obtained with PLS
% Rows (subjects) of Y are permuted within each diagnostic group
%
% Inputs:
% - X                    : N x M matrix, N is #subjects, M is #FC 
% - Y                    : N x B matrix, N is #subjects, B is #behaviors
% - U                    : B x L matrix, behavior saliences
% - S                    : L x L matrix, singular values
% - nPerms               : number of permutations
% - grouping             : N x 1 vector, subject grouping 
% - normalization_img    : normalization options for FC data
% - normalization_behav  : normalization options for behavior data
%                          0 = no normalization
%                          1 = zscore across all subjects
%                          2 = zscore within groups (default)
%                          3 = std normalization across subjects (no centering)
%                          4 = std normalization within groups (no centering)
% - seed                 : seed for random number generator, e.g. 1
%                          (default is 1000)
%
% Outputs:
% - pvals_LC             : p-values for each latent component
%
% Written by Valeria Kebets and the MIPlab, with subfunctions borrowed
% from PLS toolbox by Rotman Baycrest
% (https://www.rotman-baycrest.on.ca/index.php?section=84)

% Set random number generator 
if isempty(seed)
    rng(1000,'twister');
else
    rng(seed,'twister');
end