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: corrTCs.m
    path of file: ./repos/automaticanalysis/extrafunctions
    
    the code of the file until where you have to start completion: %% This function correlates timecourses and displays a useful fi
    
function correlates timecourses and displays a useful figure...
% Inputs:
%   aggrVars = PxC matrix, where P are timepoints across which to
%       correlate, and C are columns whose correlations with one another
%       you wish to see
%   TCnames = names for the columns
%   NaNnonsig = whether to NaN non-significant correlations (1 by default)
%   plotTCs = whether to plot the timecourses (1 by default)
function [sharedVar, h] = corrTCs(aggrVars, TCnames, NaNnonsig, plotTCs)

if nargin < 2
    aas_log([],true,'Not enough input variables')
end