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_ArealMSHBM_component_distance.m
    path of file: ./repos/CBIG/stable_projects/brain_parcellation/Kong2022_ArealMSHBM/lib
    
    the code of the file until where you have to start completion: function eucli_dist = CBIG_ArealMSHBM_component_distance(lh_labels, rh_labels, mesh, num_parcel)
    
% eucli_dist = CBIG_ArealMSHBM_component_distance(lh_labels, rh_labels, mesh, num_parcel)
%
% This script will compute the Euclidean distances between distributed components for each 
% parcel of a given parcellation <lh_labels> <rh_labels>. The output <eucli_dist> is defined
% as the maximum shortest distance among components. Parcels with a single component (i.e. 
% contiguous parcels) will be denoted as 0 in the output vector <eucli_dist>. For example, if
% parcel 1 has 3 components A,B,C. The shortest distance between A and B is 3, the shortest 
% distance between A and C is 2, the shortest distance between B and C is 4. Then eucli_dist(1)
% = 4.
%
% Input:
%   - lh_labels, rh_labels: (Nx1 vector)
%     The given parcellation labels. Medial wall should be denoted as 0.
%
%   - mesh: (string)
%     The mesh name of the parcellation surface space. For example, 'fsaverage6', 'fs_LR_32k'.
%
%   - num_parcel: (scalar)
%     The total number of parcels (excluding medial wall). For example, 400.
%

    
function eucli_dist = CBIG_ArealMSHBM_component_distance(lh_labels, rh_labels, mesh, num_parcel)
    
% eucli_dist = CBIG_ArealMSHBM_component_distance(lh_labels, rh_labels, mesh, num_parcel)
%
% This script will compute the Euclidean distances between distributed components for each 
% parcel of a given parcellation <lh_labels> <rh_labels>. The output <eucli_dist> is defined
% as the maximum shortest distance among components. Parcels with a single component (i.e. 
% contiguous parcels) will be denoted as 0 in the output vector <eucli_dist>. For example, if
% parcel 1 has 3 components A,B,C. The shortest distance between A and B is 3, the shortest 
% distance between A and C is 2, the shortest distance between B and C is 4. Then eucli_dist(1)
% = 4.
%
% Input:
%   - lh_labels, rh_labels: (Nx1 vector)
%     The given parcellation labels. Medial wall should be denoted as 0.
%
%   - mesh: (string)
%     The mesh name of the parcellation surface space. For example, 'fsaverage6', 'fs_LR_32k'.
%
%   - num_parcel: (scalar)
%     The total number of parcels (excluding medial wall). For example, 400.
%
% Output:
%   - eucli_dist: (1xnum_parcel vector)
%     The maximum shortest distances among components for each parcel of a given parcellation.
%
% Example:
%   eucli_dist = CBIG_ArealMSHBM_component_distance(lh_labels, rh_labels, 'fs_LR_32k', 400);
%
% Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md

addpath(fullfile(getenv('CBIG_CODE_DIR'), 'stable_projects', 'brain_parcellation', 'Kong2019_MSHBM', 'lib'));

%% Find distributed parcels
parcel_components = CBIG_ArealMSHBM_compute_components_general(lh_labels, rh_labels, mesh, num_parcel);
parcels = find(parcel_components == 1);
parcels_dist = find(parcel_components > 1);
eucli_dist = zeros(size(parcel_components));

%% If there exists any distributed parcel
if(~isempty(parcels_dist))
    for i = parcels
        lh_labels(lh_labels == i) = 0;
        rh_labels(rh_labels == i) = 0;
    end