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: TS_Normalize.m
    path of file: ./repos/hctsa/PlottingAnalysis
    
    the code of the file until where you have to start completion: function outputFileName = TS_Normalize(normFunction,filterOptions,fileName_HCTSA,classVarFilter,keepCalcTime)
% TS_Normalize  Trims and normalizes data from an hctsa analysis.
%
% Reads in data fro
    
function keepInd = filterNaNs(XMat,nan_thresh,objectName)
    % Returns an index of rows of XMat with at least nan_thresh good values.

    if nan_thresh == 0
        keepInd = true(size(XMat,1));
        return
    else
        propNaN = mean(isnan(XMat),2); % proportion of NaNs across rows
        keepInd = (1-propNaN >= nan_thresh);
        if all(~keepInd)
            error('No %s had more than %4.2f%% good values.\nSet a more lenient threshold.',...
                                objectName,nan_thresh*100)
        end