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_TRBPC_create_annot_r_overlay_Schaefer400.m
    path of file: ./repos/CBIG/stable_projects/predict_phenotypes/ChenTam2022_TRBPC/figure_utilities/surface_plots
    
    the code of the file until where you have to start completion: function CBIG_TRBPC_create_annot_r_overlay_Schaefer400(input_vec, out_dir, lims, cmap)

%% This function will project a vector onto the Schaefer 400 parcellation

% Required inputs
% - input_vec: a 1x400 vector
% - out_dir: path to an output directory
% - lims: min and max values for colour scale e.g. [0 100]
% - cmap: a string that specifies what colour map is needed. Options are
% 'hot' or 'cold'
%
% Written by Ruby Kong & CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

%%


    
function CBIG_TRBPC_create_annot_r_overlay_Schaefer400(input_vec, out_dir, lims, cmap)

%% This function will project a vector onto the Schaefer 400 parcellation

% Required inputs
% - input_vec: a 1x400 vector
% - out_dir: path to an output directory
% - lims: min and max values for colour scale e.g. [0 100]
% - cmap: a string that specifies what colour map is needed. Options are
% 'hot' or 'cold'
%
% Written by Ruby Kong & CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

%%

%SET min and max threshold for colorbar:
min_th = lims(1);
max_th = lims(2);

%SET annot file output dir:
mkdir(out_dir);

%SET annot file output filename:
lh_annot_file=fullfile(out_dir,'lh_data.annot');
rh_annot_file=fullfile(out_dir,'rh_data.annot');

%load Alex parcellation
load('Schaefer2018_400Parcels_17Networks_fslr_164K.mat');

lh_data=zeros(163842,1);
rh_data=zeros(163842,1);
input_vec(isnan(input_vec)) = 0;
for i=1:400
    lh_data(HCP.lh_labels==i)=input_vec(i);
    rh_data(HCP.rh_labels==i)=input_vec(i);
end