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: dijkstra_shepard.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function [W,dist_H_V] = dijkstra_shepard(V,F,C,p)
  % DIJKSTRA_SHEPARD Compute shepard weights for a list of vertices, given a
  % list of samples and optionally a denominator power value. But use "geodesic
  % distance" as defined by dijkstra's shortest path distances
  %
  % W = dijkstra_shepard(V,C)
  %
  % Inputs:
  %   V  list of vertex positions
  %   F  #F by 3 list of face indices
  %   C  list of control vertices
  %   p  (optional) power for denominator, scalar or list same size as C {2}
  % Outputs:
  %   W  weights, # vertices by # handles matrix of weights
  %
  % See also: shepard

    
function [W,dist_H_V] = dijkstra_shepard(V,F,C,p)
  % DIJKSTRA_SHEPARD Compute shepard weights for a list of vertices, given a
  % list of samples and optionally a denominator power value. But use "geodesic
  % distance" as defined by dijkstra's shortest path distances
  %
  % W = dijkstra_shepard(V,C)
  %
  % Inputs:
  %   V  list of vertex positions
  %   F  #F by 3 list of face indices
  %   C  list of control vertices
  %   p  (optional) power for denominator, scalar or list same size as C {2}
  % Outputs:
  %   W  weights, # vertices by # handles matrix of weights
  %
  % See also: shepard
  %

  % check if either are 3D but really all z's are 0
  V_flat = size(V,2) == 3 && (sqrt(sum(V(:,3).^2)) < 1e-10);
  C_flat = size(C,2) == 3 && (sqrt(sum(C(:,3).^2)) < 1e-10);
  % is both are essentially 2D then ignore z-coords
  if((size(C,2) == 2 || C_flat) && (size(V,2) == 2 || V_flat))
    % ignore z coordinate
    V = V(:,1:2);
    C = C(:,1:2);
  end