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: blockindx2cmbindx.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/private
    
    the code of the file until where you have to start completion: function [cmbindx, n, blocklabel] = blockindx2cmbindx(labelcmb, blockindx, block)

% This is a helper function that is needed for the bookkeeping of the data,
% when requesting (conditional)-blockwise granger causality estimates. Its
% single use is in ft_connectivityanalysis, but in order to keep that code
% clean, it was decided to put this function as a private function.
%
% Use as 
%   [cmbindx, n, blocklabel] = blockindx2cmbindx(labelcmb, blockindx,
%   block)
%
% The purpose is to generate a cell-array (Nx2, same size as input array
% block) of numeric indices, which index into the rows of the Mx2 labelcmb
% array, and which can subsequently be used by lower-level functionality
% (i.e. blockwise_conditionalgranger) to compute the connectivity metric of
% interest. Blockindx is a 1x2 cell-array, which maps the individual
% channels in blockindx{1} to an indexed block in blockindx{2}. Block
% specifies in each row of cells two ordered lists of blocks that are
% needed to compute a conditioned Granger spectrum.

% Copyright (C) 2010-2017 Jan-Mathijs Schoffelen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

% The variable labelcmb contains the specification of how each
% row of the data has been computed, from chanX to chanY given a multivariate
% decomposition of [chanA,...,chanZ], first generate a cell-array y and z
% that splits the channel pair from the multivariate block
y = cell(size(labelcmb));
z = cell(size(labelcmb,1),1);

    
function [cmbindx, n, blocklabel] = blockindx2cmbindx(labelcmb, blockindx, block)

% This is a helper function that is needed for the bookkeeping of the data,
% when requesting (conditional)-blockwise granger causality estimates. Its
% single use is in ft_connectivityanalysis, but in order to keep that code
% clean, it was decided to put this function as a private function.
%
% Use as 
%   [cmbindx, n, blocklabel] = blockindx2cmbindx(labelcmb, blockindx,
%   block)
%
% The purpose is to generate a cell-array (Nx2, same size as input array
% block) of numeric indices, which index into the rows of the Mx2 labelcmb
% array, and which can subsequently be used by lower-level functionality
% (i.e. blockwise_conditionalgranger) to compute the connectivity metric of
% interest. Blockindx is a 1x2 cell-array, which maps the individual
% channels in blockindx{1} to an indexed block in blockindx{2}. Block
% specifies in each row of cells two ordered lists of blocks that are
% needed to compute a conditioned Granger spectrum.

% Copyright (C) 2010-2017 Jan-Mathijs Schoffelen
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

% The variable labelcmb contains the specification of how each
% row of the data has been computed, from chanX to chanY given a multivariate
% decomposition of [chanA,...,chanZ], first generate a cell-array y and z
% that splits the channel pair from the multivariate block
y = cell(size(labelcmb));
z = cell(size(labelcmb,1),1);
cmbindx = cell(size(block));
n       = cell(size(block));
for k = 1:size(y,1)
  x1     = strfind(labelcmb{k,1},'['); 
  x2     = strfind(labelcmb{k,1},']');
  y{k,1} = labelcmb{k,1}(1:x1-1);    % string denoting single channel
  z{k,1} = labelcmb{k,1}(x1+1:x2-1); % concatenated string of all channels in the current blockwise decomp
  x1     = strfind(labelcmb{k,2},'['); 
  y{k,2} = labelcmb{k,2}(1:x1-1);
end