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_IndCBM_extract_MSHBM_result.m
    path of file: ./repos/CBIG/stable_projects/brain_parcellation/Xue2021_IndCerebellum
    
    the code of the file until where you have to start completion: function CBIG_IndCBM_extract_MSHBM_result(project_dir)

% CBIG_IndCBM_extract_MSHBM_result(project_dir)
% This function extract individual cerebral cortical parcellations after
% estimating group priors by step 2 of MSHBM algorithm.
%
% Input:
%     - project_dir: 
%           Params_Final.mat from MSHBM step 2 should be saved under

    
function CBIG_IndCBM_extract_MSHBM_result(project_dir)

% CBIG_IndCBM_extract_MSHBM_result(project_dir)
% This function extract individual cerebral cortical parcellations after
% estimating group priors by step 2 of MSHBM algorithm.
%
% Input:
%     - project_dir: 
%           Params_Final.mat from MSHBM step 2 should be saved under
%           project_dir/priors
%           Extracted individual cerebral cortical parcellations will be
%           saved under project_dir/ind_parcellation
%
% Written by XUE Aihuiping and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

% Load mat file
final = load(fullfile(project_dir, 'priors', 'Params_Final.mat'));
vertex_num = size(final.Params.s_lambda, 1) / 2;
num_clusters = size(final.Params.s_lambda, 2);
sub_num = size(final.Params.s_lambda, 3);

output_dir = fullfile(project_dir, 'ind_parcellation');
if(~exist(output_dir))
    mkdir(output_dir);
end