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: fit_resampleBasis.m
    path of file: ./repos/osprey/libraries/FID-A/fitTools
    
    the code of the file until where you have to start completion: function [resBasisSet] = fit_resampleBasis(dataToFit, basisSet)
%% [resBasisSet] = fit_resampleBasis(dataToFit, basisSet)
%   This function downsamples basis functions (which are usually given in
%   higher resolution than the data that is to be fitted) to match the
%   resolution and frequency range of the data.
%
%   USAGE:
%       [resBasisSet] = fit_resampleBasis(dataToFit, basisSet);
%
%   INPUTS:
%       dataToFit   = Individual FID-A data container.
%       basisSet    = FID-A basis set container.
%
%   OUTPUTS:

    
function [resBasisSet] = fit_resampleBasis(dataToFit, basisSet)
%% [resBasisSet] = fit_resampleBasis(dataToFit, basisSet)
%   This function downsamples basis functions (which are usually given in
%   higher resolution than the data that is to be fitted) to match the
%   resolution and frequency range of the data.
%
%   USAGE:
%       [resBasisSet] = fit_resampleBasis(dataToFit, basisSet);
%
%   INPUTS:
%       dataToFit   = Individual FID-A data container.
%       basisSet    = FID-A basis set container.
%
%   OUTPUTS:
%       resBasisSet = FID-A basis set container containing resampled basis functions.
%
%   AUTHOR:
%       Dr. Georg Oeltzschner (Johns Hopkins University, 2019-09-05)
%       goeltzs1@jhmi.edu
%
%   CREDITS:
%       This code is based on numerous functions from the FID-A toolbox by
%       Dr. Jamie Near (McGill University)
%       https://github.com/CIC-methods/FID-A
%       Simpson et al., Magn Reson Med 77:23-33 (2017)
%
%   HISTORY:
%       2019-09-05: First version of the code.


% Determine the ppm ranges of both the data and the basis functions.
ppmRangeData        = dataToFit.ppm';
ppmRangeBasis       = basisSet.ppm;
ppmIsInDataRange    = (ppmRangeBasis < ppmRangeData(1)) & (ppmRangeBasis > ppmRangeData(end