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: triSurfRemoveThreeConnect.m
    path of file: ./repos/GIBBON/lib
    
    the code of the file until where you have to start completion: function [varargout]=triSurfRemoveThreeConnect(varargin)

% function [Ft,Vt,Ct,L]=triSurfRemoveThreeConnect(Fd,Vd,Cd)
% ------------------------------------------------------------------------
% In a surface triangulation "3-connected" locations often contain poor
% quality triangles of a locally smaller area then the rest of the surface.
% Smoothening does not resolve this issue since the quality is not great
% improved even after vertex is at the centre of its neighbouring nodes.
% Hence the function triSurfRemoveThreeConnect instead removes the central
% nodes and groups the affected triangles into a single triangle.
% The input sets Fd, Vd and Cd represent the input faces, vertices and face
% colours respectively. The output sets Ft, Vt and Ct represent the fixed
% faces, vertices and face colours respectively. In addition a logic L can
% be output which defines the affected vertices in Vd. The output may
% consist of [Ft,Vt] or [Ft,Vt,Ct] or [Ft,Vt,Ct,L].
% The last nnz(L)/3 faces in Ft represent the fixed faces.
%
%
% Kevin Mattheus Moerman
% gibbon.toolbox@gmail.com
% 
% 2014/06/03 Created

    
function [varargout]=triSurfRemoveThreeConnect(varargin)

% function [Ft,Vt,Ct,L]=triSurfRemoveThreeConnect(Fd,Vd,Cd)
% ------------------------------------------------------------------------
% In a surface triangulation "3-connected" locations often contain poor
% quality triangles of a locally smaller area then the rest of the surface.
% Smoothening does not resolve this issue since the quality is not great
% improved even after vertex is at the centre of its neighbouring nodes.
% Hence the function triSurfRemoveThreeConnect instead removes the central
% nodes and groups the affected triangles into a single triangle.
% The input sets Fd, Vd and Cd represent the input faces, vertices and face
% colours respectively. The output sets Ft, Vt and Ct represent the fixed
% faces, vertices and face colours respectively. In addition a logic L can
% be output which defines the affected vertices in Vd. The output may
% consist of [Ft,Vt] or [Ft,Vt,Ct] or [Ft,Vt,Ct,L].
% The last nnz(L)/3 faces in Ft represent the fixed faces.
%
%
% Kevin Mattheus Moerman
% gibbon.toolbox@gmail.com
% 
% 2014/06/03 Created
% 2015/05/01 Updated with varagin type input
%------------------------------------------------------------------------

%% Parse input
Fd=varargin{1};
Vd=varargin{2};

if nargin==3
    Cd=varargin{3};
else
    Cd=[];
end