function [retX,retIdx,mX,sdX] = Standardize(inX)
%function [retX,retIdx,mX,sdX] = Standardize(inX)
% 
% Standardize column variables in inX.
%
% Output:
%   retX: standardized inX;
%   mX: estimated mean of the column variables in inX;
%   sdX: estimated standard deviation of the column variables in inX;
%
% Dabao Zhang    June 4, 2013
%
% Revised by:
%
% Copyright (c) 2013 by Dabao Zhang.

error(nargchk(1, 1, nargin));

% Centralize X appropriately according to W:
mX = mean(inX,1);
sdX = std(inX,0,1);
retIdx = find(sdX>eps);
retX = bsxfun(@minus,inX(:,retIdx),mX(retIdx));
retX = bsxfun(@rdivide, retX, sdX(retIdx));
