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_plot_tbss.m
    path of file: ./repos/CBIG/stable_projects/predict_phenotypes/Ooi2022_MMP/generate_figures/feature_importance_figures
    
    the code of the file until where you have to start completion: function CBIG_MMP_plot_tbss(importance, save_dir, prefix, skeleton_mask)


    
function CBIG_MMP_plot_tbss(importance, save_dir, prefix, skeleton_mask)

% CBIG_MMP_plot_tbss(importance, save_dir, prefix, skeleton_mask)
% Creates feature importance plots on tbss skeleton. 
%
% Input:
% - importance
% A #tbss_voxels-length vector with importance values.
%
% - save_dir
% The directory in which the images should be saved.
%
% - prefix
% The prefix to append to the saved images.
%
% - skeleton_mask
% Binary tbss skeleton mask derived from thresholding FA.
%
% Output: 
% - Images with file name "prefix_tbss.png"
% One image will be generated representing feature importance values.
% 
% Written by Leon Ooi and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

% Make sure that there are no NaN, skip if detected
if any(isnan(importance))
    fprintf('NaN detected, unable to plot feature importance. \n')
    return
end

% initialize atlases and tbss mask
std_brain = fullfile(getenv('FSLDIR') , 'data', 'standard', 'MNI152_T1_1mm_brain.nii.gz'); 
cbar_file = fullfile(getenv('CBIG_CODE_DIR'),'stable_projects', 'predict_phenotypes', ...
   'Ooi2022_MMP', 'generate_figures', 'feature_importance_figures', 'colorbar_horz.png');
jhu_atlas = fullfile(getenv('FSLDIR'), 'data', 'atlases', 'JHU', ...
    'JHU-ICBM-labels-1mm.nii.gz');
jhu = MRIread(jhu_atlas);
tbss_mask = MRIread(skeleton_mask);
mask_vol = tbss_mask.vol;
% replace mask with importance values
importance_std_norm = importance ./ std(importance); % normalize by std
new_vol = zeros(size(mask_vol));
importance_vol(mask_vol == 1) = importance_std_norm;
% replace atlas tracts with feature importance values
all_loadings = zeros(48,2);
for n = 1:48
    mean_loading = mean(importance_vol(jhu.vol == n & mask_vol == 1));
    new_vol(jhu.vol == n) = mean_loading;
    all_loadings(n,1)  = n;
    all_loadings(n,2)  = mean_loading;
end