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: AdaptiveBins.m
    path of file: ./repos/CanlabCore/CanlabCore/External/umap/util
    
    the code of the file until where you have to start completion: %   Class for probability binning described at
%   https://www.ncbi.nlm.nih.gov/pubmed/11598946
%
%   Bioinformatics inventors
%   Original:  Roederer M1, Moore W, Treister A, Hardy RR, Herzenberg LA.
%   Incorporation into QF matching:  Darya Orlov
    
function lvl=DEBUG_LEVEL
            lvl=0;
            %lvl=1;
        end
        
        function emd=Emd(tData, sData, bins)
            try
                tN=size(tData, 1);
                sN=size(sData, 1);
                mx=max([tN sN]);
                minEvents=floor(2*log(mx));
                numberOfBins=floor(mx/minEvents);
                if numberOfBins<32
                    bins=5;
                elseif numberOfBins<64
                    bins=6;
                elseif numberOfBins<128
                    bins=7;
                elseif nargin<3
                    bins=8;
                end