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: readTGF.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function [V,E,P,BE,CE,PE] = readTGF(filename)
  % READTGF
  %
  % [V,E,P,BE,CE,PE] = readTGF(filename)
  %
  % Read a graph from a .tgf file
  %
  % Input:
  %  filename  .tgf file name
  % Ouput:
  %  V  # vertices by 3 list of vertex positions
  %  E  # edges by 2 list of edge indices
  %  P  # point-handles list of point handle indices

    
function [V,E,P,BE,CE,PE] = readTGF(filename)
  % READTGF
  %
  % [V,E,P,BE,CE,PE] = readTGF(filename)
  %
  % Read a graph from a .tgf file
  %
  % Input:
  %  filename  .tgf file name
  % Ouput:
  %  V  # vertices by 3 list of vertex positions
  %  E  # edges by 2 list of edge indices
  %  P  # point-handles list of point handle indices
  %  BE # bone-edges by 2 list of bone-edge indices
  %  CE # cage-edges by 2 list of cage-edge indices
  %  PE # pseudo-edges by 2 list of pseudo-edge indices
  % 
  % Assumes that graph vertices are 3 dimensional

  V = [];
  E = [];
  BE = [];
  CE = [];
  PE = [];
  fp = fopen(filename,'r');
  % read next whole line
  line = fscanf(fp,' %[^\n]s');
  % read vertices until seeing separator
  while(line(1,1) ~= '#')
    [v,count] = sscanf(line,'%d %g %g %g',4);
    % first number is always index
    v = v(2:min(count,4));
    V = [V;v'];
    line = fscanf(fp,' %[^\n]s');
  end