function Xs = standardise(X)
%function Xs = standardise(X)
%
% Standardises the data in X, by making column means equal to 0
% and column variances equal to 1
%
%INPUTS
% X = the data matrix containing ell samples (the rows) and N
% coordinates (ell x N)
% Xs = the standardised version of X
%
%
%For more info, see www.kernel-methods.net
% original data stored in ell x N matrix X
% output uses the same variable X
% M is a row vector storing the column averages
% SD stores the column standard deviations
ell = size(X,1);
M = sum(X) / ell;
M2 = sum(X.^2)/ell;
SD = sqrt(M2 - M.^2);
X = (X - ones(ell,1)*M)./(ones(ell,1)*SD);