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: simplexImIntersect.m
    path of file: ./repos/GIBBON/lib
    
    the code of the file until where you have to start completion: function [regionLabel]=simplexImIntersect(varargin)

% [logicOut]=simplexImIntersect(F1,V1,C1,V2,voxelSize)

    
function [regionLabel]=simplexImIntersect(varargin)

% [logicOut]=simplexImIntersect(F1,V1,C1,V2,voxelSize)
% ------------------------------------------------------------------------
% This function uses the input simplex (or simplices) defined by F1
% (faces), V1 (vertices), and C1 (boundary labels) to label the vertices V2
% according to what simplex regions they are contained in. The labels are
% stored in the output regionLabel. A vertex inside a simplex region is
% labelled with the boundary label of the simplex region. Vertices outside
% of all simplices are labelled with NaN. Points are labelled based on the
% patch2Im function, i.e. the following steps are used: 
% 1) The simplex is converted to an image where voxels intensities denote
% simplex region labels. (see patch2Im).
% 2) The vertices in V2 are converted to image coordinates in this image
% 3) The image coordinates are converted to image voxel indices
% 4) Voxel indices are used to retrieve the labels from the simplex image. 
%
% The image constructed uses the optional input voxelSize (the default if
% not provided is half of the mean edge size of the input simplex). The
% completeness/accuracy of the labelling depend