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: patchUnderlaySG.m
    path of file: ./repos/brainSurfer/scripts/patch
    
    the code of the file until where you have to start completion: function [varargout] = patchUnderlaySG(underlays,varargin)
% This function will patch curvature onto an existing surface. It will
% require you to pass in left and right hemisphere curvature data
% separately (either both, or only one) and specify the hemisphere. There
% are a number of optional arguments that may be passed as well. The
% arguments that affect cruvature data values will be processed in the
% following order: i) if positive or negative values are set to 'off' they
% will be removed from the passed in curvature data, ii) 'vls' will be
% processed in order to scale, normalize, or convert data to percentiles,
% iii) a threshold will be applied to the resulting data.
%
% Remaining optional arguments deal with the way in which data is plotted,
% etc.
%
% Mandatory arguments------------------------------------------------------ 
%
% figID: handle to figure containing surface onto which we will patch
%
% underlays: a structure containing left and right surface patches (i.e.,
% underlays.left and underlays.right; one of these can be empty)
%
% 'lh' and 'rh': Left and/or right hemisphere curvature data must be passed
% in as well (as an argument pair; the name of the variable containing the
% data does not matter)
%
% Outputs------------------------------------------------------------------ 
%
% underlays: returns the updated patch information
%
% colormapSG: returns a structure containing the colormaps and the colorbar
%
% ticksSG: returns a structure containing information about where you should
% put your ticks if you want to generate your own colorbar (colorbar in
% colormapSG just contains a value for each bin in colormap).
%
% Optional arguments------------------------------------------------------- 
%
% 'pos': if set to 'off' positive values will be removed from curvature
% data (deafult is 'on').
%
% 'neg': if set to 'off' negative values will be removed from curvature
% data (deafult is 'on').
%
% 'vls' has various effects all of which normalize/scale/standardize the
% curvature data (default is 'raw'):
%   'raw': will patch raw values
%   'prct': will convert values to percentiles
%   'prctSep': will convert values to percentiles (separately for positive
%       and negative values)
%   'norm': will normalize values
%   'normSep': will normalize positive and negative values separately
%   'scl': will scale values between -1 and 1
%   'sclSep': will scale values between -1 and 1 (separately for positive
%       and negative values)
%   'sclAbs': will scale values between 0 and 1
%   'sclAbsSep': will scale values between 0 and 1 (separately for positive
%       and negative values)
%
% 'thresh': will remove data falling in the interval [a b] (deafult is [0 0]).
%
% 'colormap': an internal matlab colormap, or the name of any other
%       colormap redistributed with brainSurfer: 'jet', parula, hsv, hot,
%       cool, spring, summer, autumn, winter, gray, bone, copper, pink,
%       lines, colorcube, prism, spectral, RdYlBu, RdGy, RdBu, PuOr, PRGn,
%       PiYG, BrBG, YlOrRd, YlOrBr, YlGnBu, YlGn, Reds, RdPu, Purples,
%       PuRd, PuBuGn, PuBu, OrRd, oranges, greys, greens, GnBu, BuPu, BuGn,
%       blues, set3, set2, set1, pastel2, pastel1, paired, dark2, accent,
%       inferno, plasma, vega10, vega20b, vega20c, viridis, thermal,

    
function [varargout] = patchUnderlaySG(underlays,varargin)
% This function will patch curvature onto an existing surface. It will
% require you to pass in left and right hemisphere curvature data
% separately (either both, or only one) and specify the hemisphere. There
% are a number of optional arguments that may be passed as well. The
% arguments that affect cruvature data values will be processed in the
% following order: i) if positive or negative values are set to 'off' they
% will be removed from the passed in curvature data, ii) 'vls' will be
% processed in order to scale, normalize, or convert data to percentiles,
% iii) a threshold will be applied to the resulting data.
%
% Remaining optional arguments deal with the way in which data is plotted,
% etc.
%
% Mandatory arguments------------------------------------------------------ 
%
% figID: handle to figure containing surface onto which we will patch
%
% underlays: a structure containing left and right surface patches (i.e.,
% underlays.left and underlays.right; one of these can be empty)
%
% 'lh' and 'rh': Left and/or right hemisphere curvature data must be passed
% in as well (as an argument pair; the name of the variable containing the
% data does not matter)
%
% Outputs------------------------------------------------------------------ 
%
% underlays: returns the updated patch information
%
% colormapSG: returns a structure containing the colormaps and the colorbar
%
% ticksSG: returns a structure containing information about where you should
% put your ticks if you want to generate your own colorbar (colorbar in
% colormapSG just contains a value for each bin in colormap).
%
% Optional arguments------------------------------------------------------- 
%
% 'pos': if set to 'off' positive values will be removed from curvature
% data (deafult is 'on').
%
% 'neg': if set to 'off' negative values will be removed from curvature
% data (deafult is 'on').
%
% 'vls' has various effects all of which normalize/scale/standardize the
% curvature data (default is 'raw'):
%   'raw': will patch raw values
%   'prct': will convert values to percentiles
%   'prctSep': will convert values to percentiles (separately for positive
%       and negative values)
%   'norm': will normalize values
%   'normSep': will normalize positive and negative values separately
%   'scl': will scale values between -1 and 1
%   'sclSep': will scale values between -1 and 1 (separately for positive
%       and negative values)
%   'sclAbs': will scale values between 0 and 1
%   'sclAbsSep': will scale values between 0 and 1 (separately for positive
%       and negative values)
%
% 'thresh': will remove data falling in the interval [a b] (deafult is [0 0]).
%
% 'colormap': an internal matlab colormap, or the name of any other
%       colormap redistributed with brainSurfer: 'jet', parula, hsv, hot,
%       cool, spring, summer, autumn, winter, gray, bone, copper, pink,
%       lines, colorcube, prism, spectral, RdYlBu, RdGy, RdBu, PuOr, PRGn,
%       PiYG, BrBG, YlOrRd, YlOrBr, YlGnBu, YlGn, Reds, RdPu, Purples,
%       PuRd, PuBuGn, PuBu, OrRd, oranges, greys, greens, GnBu, BuPu, BuGn,
%       blues, set3, set2, set1, pastel2, pastel1, paired, dark2, accent,
%       inferno, plasma, vega10, vega20b, vega20c, viridis, thermal,
%       haline, solar, ice, oxy, deep, dense, algae, matter, turbid, speed,
%       amp, tempo, balance, delta, curl, phase, perceptually distinct
%       (default is jet). 
%       
%       Colormap can also be an l x 3 matrix of colors specifying a custom
%       colormap
%
% 'colorSpacing': determines how colors are spaced in between the limits. 
%       'even': evenly spaced between limits (default)
%       'center on zero': the midpoint of the colorbar is forced to be zero
%       'center on threshold': the midpoint of the colorbar is forced to be
%       the thresholds you've applied to your data
%
% 'colorBins': number of color bins in the colorbar (default: 1000)
%   
% 'colorSpecial': this option can assign colors in special ways: 
%       'randomizeClusterColors': each cluster in data is assigned a random
%       color on colorbar (default: 'none')
%
% 'invertColors': invert colormap (default: 'false')
%
% 'limits': two numbers that represent the limits of the colormap (default
%       is: [min(data) max(data)])
% 'opacity': sets opactiy of the patch (default: 1)
%
% 'binarize': this binarizes sulcal/gyral info into two colors
%
% 'inclZero': this determines if zeros will be patched (default: 'no')
%
% 'lights': this determines if we need to "fix" the lights
%
% 'smoothSteps': number of times to repeat smoothing procedure (i.e.,
% smoothness "kernel"; default: 0; i.e., no smoothing is performed)
%
% 'smoothArea': this is the number of closest vertices in euclidean
% distance that will be used to smooth each data point (default: 0)
%
% 'smoothThreshold': determines whether smoothing will only be applied to
% vertices that meet the thresholds that have been applied to the data
% (i.e., 'above') or to vertices below threshold. You might want to do the
% latter to shrink your map (default: 'above').
% 
% 'smoothType': 'neighbors' or 'neighborhood' (default: 'neighbors').
%
% Call: 
% [underlay, colormap, brain, data] = plotUnderlay(figID, underlays, 'lh', curv1)
% [underlay, colormap, brain, data] = plotUnderlay(figID, underlays, 'lh', curv1, 'rh', curv2)
% [underlay, colormap, brain, data] = plotUnderlay(figID, underlays, ,'lh', curv1, 'rh', curv2, 'pos','off','neg','off','vls','prct','thresh',[-2 2],)
% [underlay, colormap, brain, data] = plotUnderlay(figID, underlays, ,'lh', curv1, 'rh', curv2, 'pos','off','neg','off','vls','scl','sclLims',[-1 1],'thresh',[-2 2],'pMap',pVals,'pThresh',0.05,'operation','pc','compKeep',1,'smoothSteps',2,'smoothArea',1,'smoothThreshold','above','smoothType','neighbors');

% Defaults
options = struct('lh',[],'rh',[],'vls','raw','thresh',[0 0],'pos','on','neg','on','pMap',[],'pThresh',1,'operation','false','sclLims',[0 1],'compKeep',1,'smoothSteps', 0, 'smoothArea', 0, 'smoothThreshold', 'above', 'smoothType', 'neighbors','smoothToAssign','all','colormap','gray','colorSpacing','even','colorBins',1000,'colorSpecial','none','invertColors','false','limits',[],'binarize',[],'inclZero','on','surfC',[0.5 0.5 0.5],'sulci',[],'gyri',[],'surfOpacity',1,'sgOpacity',1,'UI',[]);
optionNames = fieldnames(options);

% Check inputs
if length(varargin) < 2
    error('You are missing an argument')
end