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: vl_whistc.m
    path of file: ./repos/panorama/lib/vlfeat-0.9.20/toolbox/misc
    
    the code of the file until where you have to start completion: function h = vl_whistc(x, w, edges, dim)
% VL_WHISTC Weighted histogram

    
function h = vl_whistc(x, w, edges, dim)
% VL_WHISTC Weighted histogram
%   H = VL_WHISTC(X,W,EDGES) behaves exactly like HISTC(X,EDGES), but
%   weights the samples X by W. Samples that have NaN weight are
%   skipped.
%
%   See also: HITSC(), VL_HELP().

% Authors: Andrea Vedladi

% Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).

numEdges = numel(edges) ;

% map x to the bins defined by edges
binIndexes = vl_binsearch(edges, x) ;

% binsearch last bin is [edges(end