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: RangeSegmentsLabeler.m
    path of file: ./repos/WDK/ARC/algorithm/5-labeling
    
    the code of the file until where you have to start completion: %labels segments using the rangeAnnotations. If the
%shouldContainEntireSegment property is set, segments are labeled as the
%rangeAnnotation th
    
function labels = labelsOfSegmentMiddlePointsContainedInRanges(~,segments,annotationSet)
            
            nSegments = length(segments);
            labels = zeros(1,nSegments);
            for i = 1 : nSegments
                segment = segments(i);
                midPoint = (segment.startSample + segment.end