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: CBIG_MMP_HCP_compute_stacking_perm_stats.m
    path of file: ./repos/CBIG/stable_projects/predict_phenotypes/Ooi2022_MMP/regression/HCP/stats
    
    the code of the file until where you have to start completion: function CBIG_MMP_HCP_compute_stacking_perm_stats(single_dir, stacking_dir, outstem, feature_mats_cell, ...
    score_ind, perm_seed_start, N_perm, family_list, subject_list, outdir)

% function CBIG_MMP_HCP_compute_stacking_perm_stats(single_dir, stacking_dir, outstem, ...
%    feature_mats_cell, score_ind, perm_seed_start, N_perm, site_list, outdir)
%
% This function performs the permutation test for the stacking model and
% saves out the prediction accuracies of the permutation test
%
% Inputs:
%   - single_dir:
%     The directory wherre the singleKRR results are.

    
function CBIG_MMP_HCP_compute_stacking_perm_stats(single_dir, stacking_dir, outstem, feature_mats_cell, ...
    score_ind, perm_seed_start, N_perm, family_list, subject_list, outdir)

% function CBIG_MMP_HCP_compute_stacking_perm_stats(single_dir, stacking_dir, outstem, ...
%    feature_mats_cell, score_ind, perm_seed_start, N_perm, site_list, outdir)
%
% This function performs the permutation test for the stacking model and
% saves out the prediction accuracies of the permutation test
%
% Inputs:
%   - single_dir:
%     The directory wherre the singleKRR results are.
%
%   - stacking_dir:
%     The directory wherre the stacking results are
%
%   - outstem
%     A string appended to the filename to specify the output files in the
%     singleKRR prediction. Must be the same as the input argument `outstem`
%     when you perform singleKRR
%
%   - feature_mats_cell
%     Cell of base file name for the input features.
%
%   - score_ind
%     A scalar. The index of the score you want to perfom the permutation test.
%     Range from 1 to # Target Variables in your kernel regression
%
%   - perm_seed_start
%     A scalar. The function will do the permutation N_perm times using
%     permutation seed from perm_seed_start to perm_seed_start+N_perm-1
%
%   - N_perm
%     Number of permutation
%
%   - family_list
%     A csv containing the family IDs of subjects.
%
%   - subject_list
%     A text file where each line is the subject ID to be extracted from family_list.
%
%   - outdir
%     Output directory for the permutation results
%
% Outputs:
%    prediction accuracies of the permutation test will be saved in the
%    outdir
%
% Written by Leon Ooi and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

%% check input arguments
if(isstr(score_ind))
    score_ind = str2num(score_ind);
end