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: spm_hist.m
    path of file: ./repos/malini/Codes/deconvolution - model/spm8
    
    the code of the file until where you have to start completion: function h = spm_hist(ind,val)
% Generate a weighted histogram
% FORMAT h = spm_hist(ind,wt)
% ind - indices (unsigned byte)
% val - weights
%
% spm_hist.c should be compiled for optimal speed.  If it is not
% compiled, then the following code is run:
%     h = full(sparse(double(ind)+1,ones(size(ind)),wt,256,1));
% For Matlab 7, the accumarray function could be used 
%_______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% John Ashburner
% $Id: spm_hist.m 1143 2008-02-07 19:33:33Z spm $


    
function h = spm_hist(ind,val)
% Generate a weighted histogram
% FORMAT h = spm_hist(ind,wt)
% ind - indices (unsigned byte)
% val - weights
%
% spm_hist.c should be compiled for optimal speed.  If it is not
% compiled, then the following code is run:
%     h = full(sparse(double(ind)+1,ones(size(ind)),wt,256,1));
% For Matlab 7, the accumarray function could be used 
%_______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% John Ashburner
% $Id: spm_hist.m 1143 2008-02-07 19:33:33Z spm $


persistent flg

%if isempty(flg),
%    flg = 0;
%    try,
%        [pth,nam,ext] = fileparts(which('spm_hist.c'));
%        mex(fullfile(pth,[nam,ext]),'-O','-outdir',pth);
%    catch,
%    end