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: perform_edge_collapse.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function [W,G,V2W] = perform_edge_collapse(V,F,C,t)
  % PERFORM_EDGE_COLLAPSE  Perform t edge collapses on mesh (V,F) based on
  % collapses C read from qslim log file
  %
  % [W,G] = perform_edge_collapse(V,F,C,t)
  %
  % Inputs:

    
function [W,G,V2W] = perform_edge_collapse(V,F,C,t)
  % PERFORM_EDGE_COLLAPSE  Perform t edge collapses on mesh (V,F) based on
  % collapses C read from qslim log file
  %
  % [W,G] = perform_edge_collapse(V,F,C,t)
  %
  % Inputs:
  %   V  #V by 3 input mesh vertex positions
  %   F  #F by 3 input mesh triangle indices (1-indexed)
  %   C  #collapse list of edge collapse structs with fields
  %     .a index into V of vertex collapsed to
  %     .b index into V of vertex collapsed from
  %     .da  1 by 3 displacement of vertex a
  %     .rm list of indices in F of faces removed by this collapse
  %     .mod list of indices in F of faces modified by this collapse
  %   t  target number of faces {0 for all collapse}
  % Outputs:
  %   W  #W by 3 collapsed mesh vertex positions
  %   G  #G by 3 collapsed mesh triangle indices (1-indexed)
  %   V2W  #V list of indices into W
  %   
  % See also: readLOG, qslim
  %

  % collapsed versions
  G = F;
  W = V;
  rm_so_far = 0;
  if nargin < 4
    t = 0;
  end