```
function [R, pValues] = bst_corrn(X, Y, RemoveMean)
% BST_CORRN: Calculates the same correlation coefficients as Matlab function corrcoef (+/- rounding errors), but in a vectorized way
% Equivalent to bst_correlation with nDelay=1 and maxDelay=0
%
% INPUTS:
% - X: [Nx,Nt], Nx signals varying in time
% - Y: [Ny,Nt], Ny signals varying in time
% - RemoveMean: If 1, removes the average of the signal before calculating the correlation
% If 0, computes a scalar product instead of a correlation
%
% NOTE: The rounding errors
% Corrcoef computes the correlation coefficients based on the variance values computed with cov(),
% instead of a direct sum of the squared values (sum(Xc.^2,2)).
% Hence it uses a corrected algorithm for the computation of the variance, that is not sensible to
% the rounding errors for large number of time samples. We do not divide the values by the number
% of samples here, so if the two signals are the same range of dynamics, those rounding errors
% should not be a problem, even for a very large number of time samples.
% @=============================================================================
% This function is part of the Brainstorm software:
```

This file has been truncated. show original