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: unparcellate.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 varargout = unparcellate(data, parcellation, parameter, parcelparam, varargin)

% UNPARCELLATE performs the reverse of a parcellation, by assigigning each
% parcel's activation to the vertices that contributed to that parcel.
%
% Use as
%
%   fun = unparcellate(data, parcellation, parameter, parcelparam, varargin)
%
% Required inputs:
%
%   data          = structure (or matrix) containing the parcellated functional data
%   parcellation  = structure describing the parcellation, i.e. the parcel
%                   membership for each of the vertices
%   parameter     = string (or cell-array with labels) that specifies the
%                   parameter to be used (if data is a structure) or how to
%                   interpret the rows in the data matrix (if data is a matrix)
%
% Additional inputs are key-value pairs and pertain to bivariate data with
% a 'labelcmb' specified in the input argument 'parameter'.
%
%   avgoverref     = 'yes' (or 'no')
%   directionality = 'both' (or 'inflow'/'outflow')
%
% Outputs:
%   fun = matrix Nvertices x size(data.(parameter),2) (or Nvertices x
%           size(data,2), containing the unparcellated data
%
%   If the input was bivariate data with a labelcmb, an optional second
%   output argument gives a list of the reference parcels.

% Undocumented input key-value pair:
%   output = 'data' (default), or 'projection matrix', only works without 'labelcmb' in input 

output = ft_getopt(varargin, 'output', 'data');

if isstruct(data)
  data_parcellated = getsubfield(data, parameter);
elseif size(parameter,2)==1
  data_parcellated = data;
  clear data;
  data.label = parameter;
  data = setsubfield(data, parameter, data_parcellated);

    
function varargout = unparcellate(data, parcellation, parameter, parcelparam, varargin)

% UNPARCELLATE performs the reverse of a parcellation, by assigigning each
% parcel's activation to the vertices that contributed to that parcel.
%
% Use as
%
%   fun = unparcellate(data, parcellation, parameter, parcelparam, varargin)
%
% Required inputs:
%
%   data          = structure (or matrix) containing the parcellated functional data
%   parcellation  = structure describing the parcellation, i.e. the parcel
%                   membership for each of the vertices
%   parameter     = string (or cell-array with labels) that specifies the
%                   parameter to be used (if data is a structure) or how to
%                   interpret the rows in the data matrix (if data is a matrix)
%
% Additional inputs are key-value pairs and pertain to bivariate data with
% a 'labelcmb' specified in the input argument 'parameter'.
%
%   avgoverref     = 'yes' (or 'no')
%   directionality = 'both' (or 'inflow'/'outflow')
%
% Outputs:
%   fun = matrix Nvertices x size(data.(parameter),2) (or Nvertices x
%           size(data,2), containing the unparcellated data
%
%   If the input was bivariate data with a labelcmb, an optional second
%   output argument gives a list of the reference parcels.

% Undocumented input key-value pair:
%   output = 'data' (default), or 'projection matrix', only works without 'labelcmb' in input 

output = ft_getopt(varargin, 'output', 'data');

if isstruct(data)
  data_parcellated = getsubfield(data, parameter);
elseif size(parameter,2)==1
  data_parcellated = data;
  clear data;
  data.label = parameter;
  data = setsubfield(data, parameter, data_parcellated);
elseif size(parameter,2)==2
  % this contains labelcmb e.g. pairwise granger
  data_parcellated = data;
  clear data;
  data.labelcmb = parameter;
  data          = setsubfield(data, parameter, data_parcellated);
end